0
votes

Having a problem with AS3, Flash player 9: When using the following code.

I cant stop the sounds on the unloaded swf from playing back after a new SWF is loaded??

I've tried putting a sound mixer stop all code on the actions panel of the opening frame for all my swf's. I have this code in my main swf, the sounds are in the loaded swf's.

I'm using Flash player 9, AS3, Flash CS5

var Xpos:Number = 53;
var Ypos:Number = 17;
var swf:MovieClip;
var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest("swfs/Animation1.swf");

loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);


 Btns Universal function
 function btnClick(event:MouseEvent):void {

removeChild(loader);
    var newSWFRequest:URLRequest = 
 new URLRequest("swfs/" + event.target.name + ".swf");
loader.load(newSWFRequest);
loader.x = Xpos;
     loader.y = Ypos;
addChild(loader);

 }
 // Btn listeners
ActivatePart1.addEventListener(MouseEvent.CLICK, btnClick);
ActivatePart2.addEventListener(MouseEvent.CLICK, btnClick);
ActivatePart3.addEventListener(MouseEvent.CLICK, btnClick);
Certificates.addEventListener(MouseEvent.CLICK, btnClick);
1
i'm curious why you are targeting FP9? - Chunky Chunk
Flash 10 will not load swf's without exported text or embeded text... i did embed and it still wouldnt work. so i published at FP9 and that fixed the issue. thats the only reason i used the FP9 setting... - Ian
i don't understand that problem without further detail but it's a bad idea to target FP9 over FP10.2. i would suggest posting a new question to solve that issue instead. - Chunky Chunk

1 Answers

0
votes

Do you call Loader.unloadAndStop() before loading a new swf in your Loader?