I have heard the unload function doesn't do a great job of removing
things from memory. Am I wrong on this?
I like to make internal variables and referencing variables null; while,
calling a remove child command from the parent.
Yet, even though the removeChild function has been called, I have noted
that you need to call the GC, because the GC does not get called
automatically... at least not in FP9
I would really like to know if I am wrong on this... it would help me
out. Is it different for FP10?
Ian Thomas wrote:
You're right that you have to remove all references - 'nulling an
instance' is a bit misleading; you simply have to make sure that no
variables refer to the clip.
However, I think you're missing something a bit more fundamental.
You're using a Loader - when you load(), the loaded SWF gets created
as a child clip of the Loader and is attached to the display tree.
Just setting a variable that points to that SWF to null is going to do
nothing at all - the clip is still on the display tree, let alone any
other references.
At least as a starting point, you should be calling Loader.unload():
http://livedocs.adobe.com/flex/3/langref/flash/display/Loader.html#unload()
Given your setup, this might achieve all that you are trying to achieve.
Beyond that, if you want to free up the memory used by that clip, you
should be looking at clearing any other variables that refer to the
clip.
HTH,
Ian
On Fri, Nov 7, 2008 at 11:08 AM, Alistair Colling
<[EMAIL PROTECTED]> wrote:
Hi there, I'm aware that if you load a SWF in AS3 it will still exist unless
you null it's instance. I'm loading in an external SWF but I can't seem to
get rid of it!
If anyone can let me know soon I would be super-grateful.
Thanks!
Here's my code:
private function startLoad(s:String):void
{
try{
mLoader = null;
}
catch(e:*){
trace("unalble to null loader");
}
try{
mLoader.unload();
}
catch(e:*){
trace("unable to unload as was nulll");
}
mLoader = new Loader();
mRequest = new URLRequest(s);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
onProgressHandler);
mLoader.load(mRequest);
}
private function onCompleteHandler(loadEvent:Event):void
{
loadedSWF = null;
trace("loaded");
anim.contentLoaded(loadEvent.currentTarget.content);
loadedSWF = loadEvent.currentTarget.content;
if (urlStr=="people.swf"){
loadedSWF.x = -345;
}else{
loadedSWF.x = -345;
}
}
--------------------------------------------------------------------------
Alistair Colling
Interactive Developer
FPP Brand Communications (Newcastle upon Tyne)
The Courtyard
Dinsdale Place
Sandyford
Newcastle upon Tyne NE2 1BD
Telephone: +44 (0)191 261 6662
Fax: +44 (0)191 233 2511
This transmission is confidential and intended solely for the person or
organisation to whom it is addressed.
It may contain privileged and confidential information. If you are not the
intended recipient, you should not
copy, distribute or take any action in reliance on it. If you have received
this transmission in error, please
notify the sender at the e-mail address above.FPP Design Limited. Reg.
Office: The Courtyard, Dinsdale Place, Sandyford, Newcastle upon Tyne NE2
1BD.Registered Number 3775564. Registered in England and Wales. Visit our
website at http://www.fpp.net/
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders