Is it possible to loop through all of the children in a class that you have added to stage?
Eg: myNewClass:testClass = new testClass()
addChild(myNewClass);
Then… Something like…
for (myVar:testClass in stage){
}
Anyone have any ideas? For now I’m just naming each child and putting the names in an array, and using getChildByName as I go through the array with a for loop.
[quote=DesignerMichael;2350798]Is it possible to loop through all of the children in a class that you have added to stage?
Eg: myNewClass:testClass = new testClass()
addChild(myNewClass);
Then… Something like…
for (myVar:testClass in stage){
}
Anyone have any ideas? For now I’m just naming each child and putting the names in an array, and using getChildByName as I go through the array with a for loop.[/quote]
maybe like this
for (var i:int=0; i < containerName.numChildren; i++) {
trace(containerName.getChildAt(i).toString( ));
}
Hmmm… I would have to put all of the players in MovieClip, and the projectiles in another.
I didn’t realize this. This makes handling depths alot easyier!
[quote=scallywag;2350804]maybe like this
ActionScript Code:
[LEFT][COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] i:[COLOR=#0000ff]int[/COLOR]=[COLOR=#000080]0[/COLOR]; i < containerName.[COLOR=#000080]numChildren[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR]containerName.[COLOR=#000080]getChildAt[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]toString[/COLOR][COLOR=#000000]([/COLOR] [COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/quote]