So I have 'home.swf' and 'play.swf' when I run apps I open home.swf first.
on home.swf there's button to play..
//home.swf
btnPlay.addEventListener(MouseEvent.CLICK, pickPlay);
function pickPlay(event:MouseEvent):void
{
var loader:Loader = new Loader();
var SWFRequest:URLRequest = new URLRequest("play.swf");
loader.load(SWFRequest);
addChild(loader);
}
on play.swf there's a button back to home
//play.swf
btnHome.addEventListener(MouseEvent.CLICK, clickHome);
function clickHome(event:MouseEvent):void
{
var loader:Loader = new Loader();
var SWFRequest:URLRequest = new URLRequest("home.swf");
loader.load(SWFRequest);
addChild(loader);
}
the problem is.. when i run it so many times.. like play and back to home, and play again.. the apps will lag. because it's like I just load home and play again and again but not unload it...
now I need to unload it but someone tell me to make main.swf to load and unload.. so when first run main.swf call home.swf first... and when we click play.. main.swf will unload home.swf and load play.swf
any solution? I hope you can get what I mean :)