Remove All Children From Display Object

/ Published in: ActionScript 3
Save to your folder(s)

The cleanest and most compact way I\'ve seen to empty out a display object.

Copy this code and paste it in your HTML
  1. private function removeAllChildren(target:DisplayObjectContainer):void
  2. {
  3. while(target.numChildren > 0) {
  4. target.removeChildAt(0);
  5. }
  6. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.