Hi cool list!
I'm trying do build a generic structure of pages (swf's) loaded in a main swf,
and unloading as well ofcourse.
Now I'm trying to unload a loaded swf, with the famous Garbage Collection. But
I'm not sure I'm doing it the right way. Hope you could point me in the right
direction.
My code:
private function loadPage( qUrl :String ) :void
{
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest( qUrl );
mLoader.contentLoaderInfo.addEventListener( Event.COMPLETE,
pageComplete );
mLoader.load( mRequest );
}
private function pageComplete( e :Event ) :void
{
currentPage = e.currentTarget.content;
currentPage.addEventListener( Page.PAGE_INIT, initPage );
currentPage.addEventListener( Page.GOTO_PAGE, gotoPage );
addChild(currentPage);
}
private function gotoPage( e :Event ) :void
{
var nextPage = currentPage.gotoPage;
currentPage.removeEventListener( Page.PAGE_INIT, initPage );
currentPage.removeEventListener( Page.GOTO_PAGE, gotoPage );
var loader:Loader = Loader( e.target );
loader.unload();
loadPage( nextPage );
}
I'm not sure about the gotoPage method, if I can make a Loader object of the
currentPage and unload it. Is it totally ready for the GC to be deleted?
Thnx in advance.
Sander
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders