# removeChild problem

**URL:** https://forum.kirupa.com/t/removechild-problem/291860
**Category:** Uncategorized
**Created:** [July 6, 2009, 8:44pm UTC](https://forum.kirupa.com/t/removechild-problem/291860 "2009-07-06T20:44:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ruiganga](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ruiganga/32/3679_2.png) [@ruiganga](https://forum.kirupa.com/u/ruiganga)
#### Post date: [July 6, 2009, 8:44pm UTC](https://forum.kirupa.com/t/removechild-problem/291860/1 "2009-07-06T20:44:04Z")

</div>

Hi

I am using the following code to addChild.

```auto
for (var j:int = 0; j < nomePostosArray.length; j++) {
		if (distritoPostosArray[j]==distritosCB.selectedLabel&&localidadePostosArray[j]==localidadesCB.selectedLabel) {
			var MA:MovieClip = new mc();
			namelistscroller.text.addChild(MA);
			MA.name="newsMc"+j;
			trace("newsMc"+j);
			MA.y=MA.height*vezes+MA.y+20*vezes;
			trace(MA.y);
			MA.nome.text=j+". "+nomePostosArray[j];
			MA.morada.text=moradaPostosArray[j];
			MA.codigo.text=codigoPostosArray[j];
			MA.contacto.text=contactosPostosArray[j];
			MA.mapLink="http://www.symbolbox.pt";
			MA.addEventListener(MouseEvent.CLICK, gotoURL);
			vezes++;
		}
	}

```

This adds alot of boxs. How can I erase all the addChilds with one function?

Thanks
