# Unloading a swf

**URL:** <https://forum.kirupa.com/t/unloading-a-swf/305435>\
**Category:** Uncategorized\
**Created:** [February 25, 2010, 7:24am UTC](https://forum.kirupa.com/t/unloading-a-swf/305435 "2010-02-25T07:24:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelafoley](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@michaelafoley](https://forum.kirupa.com/u/michaelafoley)\
**Post date:** [February 25, 2010, 7:24am UTC](https://forum.kirupa.com/t/unloading-a-swf/305435/1 "2010-02-25T07:24:06Z")

</div>

I think this is easy but i can’t figure it out. I am loading a swf movie into my main swf with a player 9 and cant get the sound to stop although the swf movie disapears. Can anyone help, please keep it simple…

my code looks something like this:

var loader:Loader = new Loader()  
addChild(loader);

test\_btn.addEventListener(MouseEvent.CLICK, Test);  
function Test(event:MouseEvent):void {

```
removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
removeChild(test_btn);
loader.load(newSWFRequest);
loader.x = 100;
loader.y = 100;
addChild(loader);
loader.unload();

```

}

this.nav\_btns.home\_btn.addEventListener(MouseEvent.CLICK, btnClick);

function btnClick(event:MouseEvent):void {

```
loader.unload();
removeChild(loader);

```

}
