# RemovechildAt Question

**URL:** <https://forum.kirupa.com/t/removechildat-question/243031>\
**Category:** flash\
**Created:** [November 2, 2007, 1:05am UTC](https://forum.kirupa.com/t/removechildat-question/243031 "2007-11-02T01:05:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mediumman](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mediumman/32/551_2.png) [@mediumman](https://forum.kirupa.com/u/mediumman)\
**Post date:** [November 2, 2007, 1:05am UTC](https://forum.kirupa.com/t/removechildat-question/243031/1 "2007-11-02T01:05:25Z")

</div>

I currently am loading to swf files into the main movie with the code below and to remove it i am using the removeChildat(0) as shown below…it works fine when they are loaded separately, however if they are both loaded how can i tell it to unload a specific one…

function clickButton(myevent:MouseEvent):void {  
var myrequest:URLRequest=new URLRequest(“theSWF1.swf”);  
var myloader:Loader=new Loader();  
myloader.load(myrequest);  
stage.addChild(myloader);

}  
function clickButton2(myevent:MouseEvent):void {  
var myrequest2:URLRequest=new URLRequest(“theSWF2.swf”);  
var myloader2:Loader=new Loader();  
myloader2.load(myrequest2);  
stage.addChild(myloader2);

}

bb.addEventListener(MouseEvent.CLICK, clickButton);  
cc.addEventListener(MouseEvent.CLICK, clickButton2);

eraseSWF2\_btn.addEventListener(MouseEvent.CLICK,erase2);

function erase2(event:MouseEvent):void {  
stage.removeChildAt(1);

}
