I have encountered same problem but in different scenario, i have 4 scenes and in my 4th scene i have 3 button inside that loads and unloads external swf. Within the 4th Scene it works perfectly but when i try to hit my main navigation (which links to Scene 1,2 and 3), the external swf is still loading to the other scenes... it's been crazy i've tried lots of method but it's not working.
Here is my script: Scene 4
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
var Xpos:Number = 525;
var Ypos:Number = 200;
var swf:MovieClip;
var loader:Loader=new Loader();
var defaultSWF:URLRequest=new URLRequest("Steps/intro.swf");
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
//button function
function btnCLICK(event:MouseEvent):void{ removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("Steps/" + event.target.name + ".swf");
loader.load(newSWFRequest); loader.x = Xpos; loader.y = Ypos; //addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(){
loader.content.height = 140;
loader.content.scaleX = loader.content.scaleY;});
addChild(loader);
}
//button listeners
NewBusinessPermit.addEventListener(MouseEvent.CLICK, btnCLICK);
RenewBusinessPermit.addEventListener(MouseEvent.CLICK, btnCLICK);
RPTAPayment.addEventListener(MouseEvent.CLICK, btnCLICK);
And i put this script to all the other scenes (1,2,3) to unload the movies fron scene4
if(stage.contains(loader)){
removeChild(loader);
}
else{
loader = null; // 've also tried replacing this with gotoAndPlay ("frame name");
}
**i actually wanted to state here that IT in these Scene (1,2 0r 3) there's still a trace of the external child swf that is still loading, remove it from the stage and continue to play whatever tween animations in this current scene. Else if you trace it that there's none, just continue and play tween animations in this current scene.
Well unfortunately i got errors, i dunno if my script meet the objective. HELP?