# How to unload external SWF from a child?

**URL:** <https://forum.kirupa.com/t/how-to-unload-external-swf-from-a-child/300693>\
**Category:** flash\
**Created:** [November 25, 2009, 6:08pm UTC](https://forum.kirupa.com/t/how-to-unload-external-swf-from-a-child/300693 "2009-11-25T18:08:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Chef](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@The\_Chef](https://forum.kirupa.com/u/The_Chef)\
**Post date:** [November 25, 2009, 6:08pm UTC](https://forum.kirupa.com/t/how-to-unload-external-swf-from-a-child/300693/1 "2009-11-25T18:08:13Z")

</div>

I have a button that loads an external movie onto the stage:

```auto

magnalock.addEventListener(MouseEvent.CLICK, magnalock_newvid);

function magnalock_newvid(event:MouseEvent) {
    trace("you clicked me");
    var loadit = new Loader();
    addChildAt(loadit,4);
    loadit.load(new URLRequest("FinalFlash/BracketWizard.swf"));
    }

```

I then have a close button right below this:

```auto

closebtn.addEventListener(MouseEvent.CLICK, closebtn_click);

function closebtn_click(event:MouseEvent):void{
    loadit.unload();  
}

```

It errors on me and says “Access to undefined property loadit.”

Any help on what I’m doing wrong with this would be really appreciated. Thanks.
