# Loading AS from another swf file?

**URL:** <https://forum.kirupa.com/t/loading-as-from-another-swf-file/305041>\
**Category:** Uncategorized\
**Created:** [February 18, 2010, 10:25am UTC](https://forum.kirupa.com/t/loading-as-from-another-swf-file/305041 "2010-02-18T10:25:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyebonk](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@eyebonk](https://forum.kirupa.com/u/eyebonk)\
**Post date:** [February 18, 2010, 10:25am UTC](https://forum.kirupa.com/t/loading-as-from-another-swf-file/305041/1 "2010-02-18T10:25:54Z")

</div>

Hello, I am creating a new site using Flash 8 AS2, I have a question but im not even sure if its possible. I have created (for arguments sake) Main.swf which is made up of a logo, music player and a main window, this main window is a MC called content (content\_mc). This loads external SWF files into it.

At the moment when the main.swf file is accesed it automatically fades content\_mc window to black then fades back out to display a swf file called ‘door.swf’ that all loads fine and heres my question — within door.swf there is a button (door\_btn) what i want to happen is when door\_btn is clicked I want it to look at the action script listed under the main.swf file and fade out content\_mc (currently displying door.swf) then fade back in with the a new swf file i.e room.swf.

So the main.swf file has no buttons on it, all the buttons will be displyed within the swf files loaded into the content MC, when any of these buttons are clicked I want the Main.swf to perfom the transition and disply the new swf file, is this possible ?

The code im using at the moment is as follows:  
In Main.swf i have a content\_MC and transition\_MC

Content\_mc

```auto

onClipEvent (enterFrame) {
 if (!loaded && this._url != _root._url) {
  if (this.getBytesLoaded() == this.getBytesTotal()) {
   loaded = true;
   _root.transition.gotoAndPlay("fadeout");
  }
 }
}

```

Transition\_mc

```auto

_root.section = "door.swf";
 
loadMovie(_root.section, _root.content);
stop();
 
Frame 10 = stop();

```

I know ive got to put some code into the external swf files but i dont know what ? Can any one help or point me in the right direction of a good tutorial ?
