Load and unload an external .swf file at specific frames using LoaderMax

Hi,

I’m actually creating a pretty simple banner that needs to stay under 40k size. I’m trying to load and unload an external .swf to my main swf file. So far, I only managed to load my external .swf, without finding a way to make it appear and disappear at specific frames (the external .swf shows up directly at frame 1, then when the animation loops over, it stacks over and over).

I read some things about onEnterFrame and counters but still wasn’t able to solve my issue.

Here’s my actual code. It makes the “horse.swf” file (located in the same folder as my main swf) fades in into my main swf after it has been loaded.

By the way, I used The LoaderMax system from greensock. because it seemed lighter and easier to manage than the native Adobe Loader one.


import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;

var loader:SWFLoader = new SWFLoader("horse.swf", {container:this, alpha:0, y:-40, x:-30, onComplete:completeHandler});

//Load Swf
loader.load();

function completeHandler(e:LoaderEvent):void{
    TweenLite.to(e.target.content, 1, {alpha:1});
}

Thank you by advance for your time and your help guys.