How to remove previous swf when enter new swf (AS3)......?
I am creating double Quiz games with 3 swf files(main.swf,A.swf,B.swf),when i load from Main.swf into another swf example into(B.swf) and reload back to Main.swf again,it works perfectly without erros... but when this process keep on looping, its seems like spamming CPU memory usage...what coding i should used to solve it? (**i guess because the previous swf file's memory not totally remove when enter another swf, new swf just replacing on top) (I used .unload(),removeChild (),stop() so on seems doesn't solve this problem..i did try my best to solve but fail) I think there must be some codes 开发者_如何学运维used solve this,i dunno what else.can give me little solutions?
Your all Kindness will be very appreciate:) Thanks
You don't need to reload each SWF in a loop! Assign a variable to the loaded SWF instead and use that variable to interact with the swf.
private var swfA:MovieClip;
private function onLoadComplete( event:Event ):void
{
//if you've loaded A.swf
swfA = event.currentTarget.content;
}
From that point on, you can:
//hide the swf
swfA.visible = false;
//remove it from stage
removeChild( swfA );
And if you had linked it to its own class , you could even call methods or set properties
//for instance...
swfA.answers = [ answer1 , answer2 .... , answern];
swfA.showResult();
精彩评论