25th Apr 2008

Removing All Children From a DisplayObject

Just a quick one. The other day someone asked me about how to remove all sub clips from a movie clip in AS3. I happened to have created a function to do that for one of my projects.

private function removeAllChildren(displayObject:DisplayObjectContainer):void {
while (displayObject.numChildren > 0) {
displayObject.removeChildAt(0);
}
}

Comments are closed.