问题描述:

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;
}
相关阅读:
Top