You're possibly missing a statement setting the variable holding the
swfloaders to null.
It's easy to miss a listener particularly if you are re-parenting swfloaders
around the displaylist.
Here's how I've done it... no memory problems. Remember garbage collection
is not immediate. If you unload something it wont be picked up for 1-2 mins.
currentViewContent is a canvas object with a 1:* swfloaders which represent
mini apps.
// loop over children, looking for swfLoaders
var currentViewChildren:Array = currentViewContent.getChildren
();
for(var i:Number = 0; i < currentViewChildren.length; i++)
{
if (currentViewChildren[i] is SWFLoader) {
trace('IQViewManager '+this+' : Close and remove
child'+currentViewChildren[i].id);
// call the hook methods to close down the application
var loadedSM:SystemManager =
SystemManager(currentViewChildren[i].content);
// if the BridgeIQ object is available as a public
property of the loaded app then
// we can call the methods
if ('BridgeIQ' in loadedSM.application) {
trace("calling terminate on sub application");
loadedSM.application['BridgeIQ'].doTerminate();
}
currentViewChildren[i].content.loaderInfo.loader.unload();
}
}
// null out the array to kill off the reference
currentViewChildren= null;
/* remove children from the view doing this removes the
SWFLoader's. There are no listeners set elsewhere so these objects should
be garbage collected
*/
if (currentViewContent.numChildren) {
currentViewContent.removeAllChildren();
trace("Removed all children of view");
}
HTH
Angus
On 09/01/07, arcencie1978 <[EMAIL PROTECTED]> wrote:
Hello folks...
I have some serious problem with loading multiple swfs in a
swfLoader whithin an application...
The problem is that... every time I load another swf in a swfloader,
the memory that the Internet Explorer uses justs keeps going up and
up
and one time (maybe after 15 - 20 minutes) it just crashes...
To be more specific, my application loads a new swf in a regular
basis (every 30 seconds)
to make it like a slideshow...
and it also has fonts embedded in it
yet to minimize the total memory used by this application,
I've did somthing like this...
var sys:SystemManager = contentLoader.content as SystemManager;
if (sys && sys.numChildren>0) {
sys.removeChildAt(0);
contentLoader.content.loaderInfo.loader.unload();
}
contentLoader.source= DisplayManager.convertToAppSWFName (
subAppID );
and every application has an removedEventHandler which listens to
removed Event,
and removes all listeners registered to it when it is removed from
this display list..
So I'm very curious why the memory usages just keeps rising...
If you have any hints, they'd be greatly appreciated...
Thanks in advance!!!!
Mark this message as the answer.