# I can't remove multiple dynamic movieClips in one go

**URL:** https://forum.kirupa.com/t/i-cant-remove-multiple-dynamic-movieclips-in-one-go/309480
**Category:** flash
**Created:** [May 16, 2010, 10:43pm UTC](https://forum.kirupa.com/t/i-cant-remove-multiple-dynamic-movieclips-in-one-go/309480 "2010-05-16T22:43:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)
#### Post date: [May 16, 2010, 10:43pm UTC](https://forum.kirupa.com/t/i-cant-remove-multiple-dynamic-movieclips-in-one-go/309480/1 "2010-05-16T22:43:53Z")

</div>

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!

```auto
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
