Hi,
I have a for loop that adds 5 movieClips to the stage at a random position every time I click the enterBtn, what I want to do if the enterBtn is click again remove the movieClips previously generated and leave only the new ones on the stage.
Oh, the number “5” in my for loop will be dynamically created so it may be different if the enterBtn is click again (I just used 5 for simplicity).
enterBtn.addEventListener(MouseEvent.CLICK, calculator,false,0,true);
function calculator(event:MouseEvent):void {
for (var i=0; i<5; i++) {
var partMc:PartMc = new PartMc();
partMc.x=Math.random()*300;
partMc.y=Math.random()*300;
addChild(partMc);
}
}
Can some help me with this?
Thanks a lot!