# Loading and Unloading external SWFs

**URL:** <https://forum.kirupa.com/t/loading-and-unloading-external-swfs/254537>\
**Category:** flash\
**Created:** [March 12, 2008, 11:38pm UTC](https://forum.kirupa.com/t/loading-and-unloading-external-swfs/254537 "2008-03-12T23:38:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohicks](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@rohicks](https://forum.kirupa.com/u/rohicks)\
**Post date:** [March 12, 2008, 11:38pm UTC](https://forum.kirupa.com/t/loading-and-unloading-external-swfs/254537/1 "2008-03-12T23:38:24Z")

</div>

Ok i am needing some more help again.

I have a button that i want to use to load an external SWF dynamically. Here is my current code for it (below).

The first problem is I’m getting error 1120: Access of undefined property contact\_btn.  
And yes my instance name of the button is contact\_btn in the property table.  
So i don’t know what it is that is causing it?

I also am clueless of how to get this clip to unload from the screen when the user clicks a button, and show the original screen the user saw before he clicked on the contact button to load the contact form.  
Or do i just use the same theory of loading the contact form, to load over the contact form that loaded over the main page when he clicked the contact button … sorry if this is getting confusing.

Any ideas?  
I need this for a big project that i must have completed in a week.  
Help is appreciated and thanked in advance!

```auto

stop();
    
// Import classes
import flash.net.URLRequest;
import flash.events.*;
import flash.display.Loader;

function contact(event:MouseEvent):void {
    var contactRequest:URLRequest = new URLRequest("contact.swf");
    var contactLoader:Loader = new Loader();
    contactLoader.load(contactRequest);
    addChild(contactLoader);
    contactLoader.x = 0;
    contactLoader.y = 0;
}

contact_btn.addEventListener(MouseEvent.CLICK, contact);

```
