ActionScript Code:
while(container.numChildren){
container.removeChildAt(0);
}
Of course to be more robust, it would be even better if you weren't dependant on numChildren in the case that maybe the container has overriden remove methods to prevent the removal of some objects. Then, you could use something like
ActionScript Code:
var i:int = container.numChildren;
while(i--){
container.removeChildAt(i);
}
Otherwise, with the first example, it would be possible to get caught in an infinite loop.