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" <[email protected]> 
To: "Flash Coders" <[email protected]> 
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 
[email protected] 
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to