Good Afternoon from a sunny England (for once!)
I’m having real problems with unloading external SWFs, I’ve spent 2 days looking for a solution and looking at this forum and using the code supplied and Flash help files and much much reading and trying, I still cannot achieve the desired results.
I have a Menu.swf which hosts many buttons which loads External SWFs … simple enough and fairly common.
These External SWFs are the same size as the menu and so loads completely over the top of Menu.swf … which is exactly what I want to happen.
I have a button on these External SWFs which I want to, delete the External SWF from the Flash player’s memory and remove all event listeners (which I guess will happen if the External SWF is deleted from memory)
The reason why I want it to remove the movie completely from memory is that I have 18 items and by the time it loads the 18th item, the player is going slower then trying to swim in hummous.
I’m using the standard Loader functions in the Menu.swf
[AS]
function Item18 (e:MouseEvent):void{
var myLoader:Loader = new Loader();
Empty_mc.addChild(myLoader);
var url:URLRequest = new URLRequest(“Item18.swf”);
myLoader.load(url);}
btn_18.addEventListener(MouseEvent.CLICK, Item18);
[/AS]
In the External SWF - was thinking something on the lines of this could work? (throws a couple of 1119 errors at me)
[AS]
function pushPH (e:MouseEvent):void{
removeChild(parent.myLoader);
parent.myLoader.unload();
Loader(currentTarget).unload();
controls.PrevItem_Btn.addEventListener(MouseEvent.CLICK, pushPH);
[/AS]
Can anyone put some light on this situation?
Thank you
Rupert