Hi,
I have a main timeline in which 2 external swf’s are loaded. Once the first one is finished, it is removed and replaced by the second one. The problem that i am having, is that I don’t know how to get rid of the second one when it is finished playing. i am very new to AS so please be as explicit as possible. Here is my code so far-
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(Event.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();
my_Loader.load(new URLRequest("sc_08_sujoy.swf"));
my_Loader.contentLoaderInfo.addEventListener(Event .COMPLETE, onLoadComplete);
}
}
Thanks.