Useful MovieClip-child tricks in AS3

Some useful MovieClip / Display Object tricks in ActionScript 3:

1. Send to front / back

To set an MC on top of everything else:

setChildIndex(yourMC, numChildren-1);

To put an MC below everything else:

setChildIndex(yourMC, 0);

http://developer.yahoo.com/flash/articles/display-list.html

2. Remove all children

while(container.numChildren){
container.removeChildAt(0);
}

http://blog.devdeploy.com/2009/10/19/remove-all-children-as3/

This entry was posted in Flash and tagged . Bookmark the permalink.

Leave a Reply