How do I get a list of all the children (Sprites) on the stage of my Document Class OR how can I get a list (length) of all the children (Sprites) of a parent (Sprite)?
One idea is that you could write a helper function that will do the work for you.
public function getChildrenOf(target:DisplayObjectContainer):Array
{
var children:Array = [];
for (var i:uint = 0; i < target.numChildren; i++)
children.push(target.getChildAt(i));
return children;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With