AS3: declaring variables in a for loop
AS3: declaring variables in a for loop
Out of context: Reply #7
- Started
- Last post
- 23 Responses
- Autokern0
To answer your question:
You can do your way only if you have the object already existing on the stageFor your purpose would better use the name property:
for (var i:uint = 1; i<= 7; i++) {
var btn:Mainbtns
btn.name = ("MainBtn" + i + "_mc")
}
and for retrieving certain instances by name you would use the
getChildbyName() function.See the DisplayObjectContainer help reference for more details.
- for reatrieving, the array will do as well.Autokern
- That's good to know. Thanks.acrossthesea