# Close swf button

**URL:** https://forum.kirupa.com/t/close-swf-button/323363
**Category:** flash
**Created:** [June 27, 2011, 5:50pm UTC](https://forum.kirupa.com/t/close-swf-button/323363 "2011-06-27T17:50:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Hvdstaal](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@Hvdstaal](https://forum.kirupa.com/u/Hvdstaal)
#### Post date: [June 27, 2011, 5:50pm UTC](https://forum.kirupa.com/t/close-swf-button/323363/1 "2011-06-27T17:50:12Z")

</div>

Hi. I have a button that loads an external swf.  
this is the code

```auto
map_btn.addEventListener(MouseEvent.CLICK, clickFunction);

function clickFunction(evt:MouseEvent):void {
tint_mc.gotoAndPlay("on");

var request:URLRequest = new URLRequest("SWFS/map.swf"); 
var loader:Loader = new Loader() 
loader.load(request); 
addChild(loader);
}
	
	

```

Now i want that same button to unload that swf-file.  
How?

I tried removeChild, but then this error appears:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display:isplayObjectContainer/removeChild()  
at menu\_fla::MainTimeline/clickFunction2()
