-
Shortcut to assigning instance names?
I have a 4x4 set of square buttons that I need to give instance names to. They will be named 'btn_1' thru 'btn_16'. Is there any shortcut to assigning the names or do I have to go through 16 times clicking on the button and clicking down to the 'instance name' text box?
-
I don't think there is an easy way to do this; if you're absolutely in need of 16 different instances, then you will need to rename each object.
-
If you have those 16 buttons already added on the stage, I'll assume the parent of the buttons is the stage, you can do
PHP Code:
for (var i = 0; i < 16; i++) { var btt:* = stage.getChildAt (i); var string:String = "btn_" + i; btt.name = string; }
That'll only work if the first 16 children of your stage are the buttons. But you can set their instance names using the .name property in AS3.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|