Hello:
I have read many many post and I don't find the answer of how to remove completely a swf load external.
Every time I load and unload I see the windows memory task manager and see that the memory increase and don't reduce when remove child.
¿Can you help me please? thank you.
this is my code:
var oneLoader=new Loader();
bt1.addEventListener(MouseEvent.CLICK, swf1);
bt2.addEventListener(MouseEvent.CLICK, removeMe);
function swf1(e:Event)
{
var oneLoader=new Loader();
addChildAt(oneLoader,1);
oneLoader.load(new URLRequest("swf1.swf"));
}
function removeMe(e:Event)
{
removeChildAt(1);
oneLoader= null;
}
:
var oneLoader=new Loader();
bt1.addEventListener(MouseEvent.CLICK, swf1);
bt2.addEventListener(MouseEvent.CLICK, removeMe);
function swf1(e:Event)
{
var oneLoader=new Loader();
addChildAt(oneLoader,1);
oneLoader.load(new URLRequest("swf1.swf"));
}
function removeMe(e:Event)
{
if(oneLoader){
oneLoader.unloadAndStop(); // if publishing for fp 10+, else must explicitly stop all streams and apply unload().
oneLoader.parent.removeChild(oneLoader);
oneLoader= null;
}
}
Thank you very much.
I have a last question.
In my external swf I have put a close button with this code:
btclose.addEventListener(MouseEvent.CLICK, CloseMe);
function CloseMe(event:MouseEvent) {
MovieClip(parent.parent).removeMe(event);
}
stop();
In the main movie i have te removeMe function that works perfectly when I close from the main, but not with the close buton of external swf, it seem does not access to the removeMe function, what is wrong here?
function removeMe(e:Event):void
{
if (oneLoader)
{
oneLoader.unloadAndStop();
// if publishing for fp 10+, else must explicitly stop all streams and apply unload().;
oneLoader.parent.removeChild(oneLoader);
oneLoader.unload(); // ..... I added, I'm use fp 11.
oneLoader= null;
}
}
Thank you again.
The code are on their right places.
But When I close with the swf button close. The window is closed but not remove from memory.
I have other button on the main movie (for try) and when I push this: close the swf and remove form memory.
Do you know why I cannot remove from the swf button?
thanks
North America
Europe, Middle East and Africa
Asia Pacific