# Help Please

**URL:** <https://forum.kirupa.com/t/help-please/257847>\
**Category:** Uncategorized\
**Created:** [April 17, 2008, 4:48pm UTC](https://forum.kirupa.com/t/help-please/257847 "2008-04-17T16:48:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![watto\_uk](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@watto\_uk](https://forum.kirupa.com/u/watto_uk)\
**Post date:** [April 17, 2008, 4:48pm UTC](https://forum.kirupa.com/t/help-please/257847/1 "2008-04-17T16:48:47Z")

</div>

Can anyone offer any advice on how to unload swfs that have been loaded into a host SWF.

For eaxmple i have my main movie and am loading an external swf into it  
this works fine however when i try to close it with another button in the main movie,  
I get this error message

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2cf8101 to flash.display.Loader.  
at VirtualSynthPiano\_fla::MainTimeline/unloadFunction()

This is my code

//button in the main movie that loads the external swf  
keyboardDragMC.btBtnMC.addEventListener(MouseEvent.MOUSE\_DOWN, loadPlayer);

function loadPlayer(myevent:MouseEvent):void {  
var myrequest:URLRequest=new URLRequest(“organBluesPlayer.swf”);  
var myloader:Loader=new Loader();  
myloader.addEventListener(“UnloadMe”, unloadFunction);  
myloader.load(myrequest);  
stage.addChild(myloader);  
}

//button in main movie that should unload the swf  
keyboardDragMC.editBtnMC.addEventListener(MouseEvent.MOUSE\_DOWN, unloadFunction);  
function unloadFunction(event:Event):void {

Loader(event.currentTarget).unload();  
}

After looking around the net this seems to be quite a common problem. Would much appreciate any advice any one could offer?

thanks

Liam.
