I can't remove multiple dynamic movieClips in one go

Hi there,

I’ve managed to add a bunch of movieClips dynamically from the library. But I don’t how I can remove them ALL dynamically now.

I’d like to be able to remove all the buttons, and then add a new lot in afterwards.

Here’s what I have so far:

It’s not a syntax or a collision error, it’s simply a case of me not having a clue what to do next!

var myBtn:myButton;
// I have a movieClip in the library with the linkage: "myButton"

function addButtons ():void {
	for (var i:Number = 0; i < 5; i++) {
		myBtn = new myButton ();
		myBtn.x = i * 100;
		myBtn.y = Math.random() * 350;
		myBtn.id = i;
		myBtn.name = "button" + i;
		addChild (myBtn);

		myBtn.buttonMode = true;
		myBtn.addEventListener(MouseEvent.CLICK, btnClick);
	}
}

function removeButtons ():void {
	for (var i:Number = 0; i < 5; i++) {
		// I can't remove them all!
		myBtn = myButton (); 
		removeChild (myBtn);
	}
	addButtons ();
}

function btnClick (evt:Event){
	//trace(evt.target.name);
	removeButtons();
}

addButtons ();

I really appreciate any ones time on this issue.

Thanks,

Mark Notton