/ Published in: ActionScript 3
DisplayObjectContainer, a parent class of the more common container classes such as MovieClip and Sprite, does not have a built in method to immediately remove all children. To remove all children we simply use a while loop to remove the child which occupies index 0 in the stack until no children remain.
Expand |
Embed | Plain Text
while (displayObjectContainer.numChildren) { displayObjectContainer.removeChildAt(0); }
Comments
Subscribe to comments
You need to login to post a comment.

This can also be done by calling DisplayObjectContainer.removeChildren(). Needs AIR3.0 of FP11 and above.
See also http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContainer.html#removeChildren%28%29