More than one way to get things done. Depends on your needs. Check out
DisplayObjectContainer in the docs.
var barMom:Sprite = new Sprite();
this.addChildAt(barMom, 0);
function createBars():void {
for (var i:int=0; i < 9; i++) {
var bar:Sprite = new Sprite();
bar.name = "barBrat" + i;
barMom.addChild(bar);
}
}
function spankABrat(container:Sprite, childName:String):void{
container.removeChild(container.getChildByName(childName));
}
function eightySixBrats(container:Sprite):void {
var len:uint = container.numChildren;
for (var i:uint = 0; i < len; i++) {
container.removeChildAt(0);
}
}
trace("barMom.numChildren =",barMom.numChildren);// 0
createBars();
trace("barMom.numChildren =",barMom.numChildren);// 9
spankABrat(barMom, "barBrat3");
trace("barMom.numChildren =",barMom.numChildren);// 8
eightySixBrats(barMom);
trace("barMom.numChildren =",barMom.numChildren);// 0
Jason:
Doesn't storing them in an array create a set of references that will need
to be cleaned up?
Regards,
Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders