/ Published in: ActionScript 3
Consider that we have a container (MovieClip) named \"cont\"\r\nand we want to erase all the movieclip inside it.
Expand |
Embed | Plain Text
while (cont.numChildren > 0){ cont.removeChildAt(0); }
Comments
Subscribe to comments
You need to login to post a comment.

You can also do something like:
while (cont.numChildren > 0){ cont.removeChildAt(0); }
You're right. That's much cleaner for removing all children. On the other hand you can't add any exceptions/filters like this:
for(var i:int = cont.numChildren-1; i>=0; i--) if (cont.getChildAt(i).x > 400){ this.removeChildAt(i); } }
Perhaps i should have set a better title and example code. Thanks for your advice!
sorry, thought it was my own post, but i just "faved" it :-)