# Question about addChild() and removeChild() AS3

**URL:** https://forum.kirupa.com/t/question-about-addchild-and-removechild-as3/277652
**Category:** flash
**Created:** [December 15, 2008, 2:14pm UTC](https://forum.kirupa.com/t/question-about-addchild-and-removechild-as3/277652 "2008-12-15T14:14:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![himandme](https://avatars.discourse-cdn.com/v4/letter/h/bbe5ce/32.png) [@himandme](https://forum.kirupa.com/u/himandme)
#### Post date: [December 15, 2008, 2:14pm UTC](https://forum.kirupa.com/t/question-about-addchild-and-removechild-as3/277652/1 "2008-12-15T14:14:33Z")

</div>

Hello

I am trying to add a movieclip from the library via AS. And then delete it  
I make a new MC in the library port with a reqtangle from 50px at 50px.  
Then i set the properies export for AS  
Class: port\_mc  
Base class:flash.display.MovieClip

this is the script i use:

var port:port\_mc;

for (var i:int = 0; i\<5; i++)  
{  
port = new port\_mc();  
port.x = i \* 80;  
addChild (port);  
}

removeChild(port)

the script places 5 instances of port on the stage. But only remove one off teh stage.  
How do i remove all five of them.  
Thx.

ps: sorry for bad english…
