To remove all children from a displayObect in as3 you can use the following loop:
while (container.numChildren) { container.removeChildAt(0); }
If you need to use a conditional - e.g. only remove certain children you can use something like the following example (in which the container is 'this'):
var n = this.numChildren; var deletionArray:Array = []; var child:DisplayObject; for (var i = 0; i<n; i++){ child = this.getChildAt(i) if ( !(child is topContainer) && !(child is tab) && !(child is bottomFrame)){ deletionArray.push(child) } } for (var j = 0; j<deletionArray.length; j++){ this.removeChild(deletionArray[j]) }