I would recommend a couple paths:

Add a removeInstance() method to your singleton(s) that will clear you
singleton upon removing your application.

Use the MultiCore version of PureMVC which is a 'multiton'. Then you
can create a new 'core' and remove the old one if it exists.
Essentially this is the same as above, but encapsulated as a design
pattern. This is a very clean way to make sure everything is correctly
dereferenced, but you are probably too far into the project to think
about applying a framework.

Peace
c

On Thu, Dec 3, 2009 at 12:41 PM, Andrew Sinning <and...@learningware.com> wrote:
> Of course this makes complete sense, but now I need to rethink how my AS2
> singletons are structured.
>
> mark.jonk...@comcast.net wrote:
>>
>> Yes it should persist.
>> When you load a movie, its classes get loaded into memory and they stay in
>> memory regardless if you offload the movie. AS3 has some additional
>> processes that do allow classes to eventually offload for *some* loaded
>> movies that are loaded into their own application domains.
>> When you load another movie, if it has a class with the same name and same
>> package, then that class is ignored, it doesn't replace the existing one.
>> Basically think of it as once loaded, always loaded, once loaded, never
>> replaced. First version in is the version for the rest of the session.
>> Hope that helps.
>> Sincerely Mark R. Jonkman
>> ----- Original Message ----- From: "Andrew Sinning"
>> <and...@learningware.com> To: "Flash Coders"
>> <flashcoders@chattyfig.figleaf.com> Sent: Thursday, December 3, 2009
>> 12:06:29 PM GMT -05:00 US/Canada Eastern Subject: [Flashcoders] AS2 static
>> var persisting when movie unloaded
>> I load in a movie into a container movie. The loaded-movie uses _lockRoot
>> = true. A singleton instance of a class is created and set as a static
>> variable of the class.
>> The movie is then unloaded and another instance of the movie is loaded
>> into the same container.
>> Should static members in classes be preserved or not? What I'm finding is
>> that my singleton is persisting. This is not what I expected.
>> Thanks!
>>
>>
>>
>> _______________________________________________ Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to