# Gaps between SWF's

**URL:** <https://forum.kirupa.com/t/gaps-between-swfs/318124>\
**Category:** Uncategorized\
**Created:** [January 11, 2011, 5:13am UTC](https://forum.kirupa.com/t/gaps-between-swfs/318124 "2011-01-11T05:13:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brenda318](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@brenda318](https://forum.kirupa.com/u/brenda318)\
**Post date:** [January 11, 2011, 5:13am UTC](https://forum.kirupa.com/t/gaps-between-swfs/318124/1 "2011-01-11T05:13:45Z")

</div>

Hi,  
Below is some code I am using to load 2 SWF into a main SWF. The first SWF loads and plays out and then is removed and is replaced with the second SWF that does the same thing. The problem I am experiencing, is that there are some blank frames during the transition from the first SWF to the second.  
I would like to avoid this, as I am trying to create a whole movie using about 80 SWF’s and cannot afford to have blank frames between every scene.

```php

var played:Boolean=false; // record of if the swf 'sc_08_sujoy.swf' has played yet
var my_Loader:Loader = new Loader();
my_Loader.contentLoaderInfo.addEventListener(Event .COMPLETE, onLoadComplete);
my_Loader.load(new URLRequest("sc_02_shyamal.swf"));
my_Loader.contentLoaderInfo.addEventListener(Event .COMPLETE, onLoadComplete);
var currentSWF:MovieClip;
function onLoadComplete(e:Event):void
{
    my_Loader.contentLoaderInfo.removeEventListener(Ev ent.COMPLETE, onLoadComplete);
    currentSWF = MovieClip(e.target.loader.content);
    currentSWF.addEventListener(Event.ENTER_FRAME, onEnterFrame);
    addChild(currentSWF);
}
function onEnterFrame(e:Event):void 
{
    if (currentSWF.currentFrame == currentSWF.totalFrames)
    {
        
        
        currentSWF.stop();
        removeChild(currentSWF);
        currentSWF.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
        // if you want to get rid of it altogether
        currentSWF = null;
        my_Loader.unloadAndStop();
        if(!played) // check have we loaded the second swf ? if not then load then second swf
        {
            my_Loader.load(new URLRequest("sc_08_sujoy.swf"));
            my_Loader.contentLoaderInfo.addEventListener(Event .COMPLETE, onLoadComplete);
        }
        played=true; // note that you have loaded your swf so this trigger is changed
    }
}

```

Thanks!
