On Tue, May 26, 2009 at 6:36 PM, Patrice O <[email protected]> wrote:

> I m facing a problem with dynamic loading/unloading of swf. I'm using a
> class "mycustomSWFLoader" which extends SWFLoader and which use an instance
> of Loader class to load swf files (graphics data) from serialized SWF in
> bytearrays.
>
> All seem to be ok, I can display any of my swf, but the flash player does
> not free memory (the previous loaded swf) when I load a new swf.

Your SWF has to do a number of things before it can be unloaded:

 1.  Stop any running timers
 2.  Remove any 'enterFrame' event listeners
 3.  Close any open network connections
 4.  Remove any objects added to the stage
 5.  Remove any event listeners from the stage
 6.  Call dispose() on any BitmapData objects
 7.  Stop any sound that's playing and close the stream

Etc.

unloadAndStop() does some of this. But some of it you have to do on
your own. For instance, you'll have to remove any event listeners or
any other references to objects inside your SWF on your own.

I had made an API for this for my entire application.

http://tech.groups.yahoo.com/group/apollocoders/message/2766

Manish

-- 
www.manishjethani.com

Reply via email to