# Control Loading and Unloading External SWFs

**URL:** <https://forum.kirupa.com/t/control-loading-and-unloading-external-swfs/257446>\
**Category:** flash\
**Created:** [April 14, 2008, 1:03pm UTC](https://forum.kirupa.com/t/control-loading-and-unloading-external-swfs/257446 "2008-04-14T13:03:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonix](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@tonix](https://forum.kirupa.com/u/tonix)\
**Post date:** [April 14, 2008, 1:03pm UTC](https://forum.kirupa.com/t/control-loading-and-unloading-external-swfs/257446/1 "2008-04-14T13:03:49Z")

</div>

Hi,

I’m trying to load and unload a swf into my main stage however im trying to fade in and fade out the swf previously i had this in as2 which on pressing a button loaded the swf into a container(mc) using the following code

```auto
on (release) 
{
   if (_root.currMovie == undefined) 
   {
      _root.currMovie = "Company";
      _parent.container.loadMovie("Company.swf");
   } 
   
   else if (_root.currMovie != "Company")
   {
      if (_parent.container._currentframe >= _parent.container.midframe) 
      {
         _root.currMovie = "Company";
         _parent.container.play();
      }
   }
}

```

this loaded the swf, within the swf itself it had a fade in until x frame which then stopped. then on pressing another menu button it would fade the current swf out by playing on from frame x and unload it then load the appropriate swf. the code within the swf is below

on first frame

```auto

midframe=25

```

on last frame

```auto

_root.container.loadMovie(_root.currMovie+".swf")

```

im trying convert this code into as3 any help would be gratefull

also find the original tutorial at [http://www.kirupa.com/developer/mx2004/transitions.htm](http://www.kirupa.com/developer/mx2004/transitions.htm)

Thanks
