AS3: declaring variables in a for loop
AS3: declaring variables in a for loop
Out of context: Reply #2
- Started
- Last post
- 23 Responses
- acrossthesea0
I think you shouldn't worry about unique instance names for each button you're making. Instead use a property (not sure if property is the right term) of "index" and make that equal to i. Then push each button you made to an array. Now each button you created has an unique identifying index that you can use down the line.
Just like I did in this example: http://pastebin.com/f39422ea8
I gave each button an index in the loop and then you can see how I used that index (e.target.index) for that click function.