My assumption is that you have a scope problem. It seems like you're
Singleton is working properly inside its own SWF, because you remarked that
the duplication when loading was unusual. It sounds like you know that the
Singleton pattern is designed to instantiate only one copy of itself, only
if it doesn't exist, or to use the existing instance. If this is working
correctly in the lone SWF, it sounds like, when loaded, there are two
scopes: the original SWF and the loaded environment. When the Singleton is
referenced after loading it is somehow relevant to the loading shell (_root,
_parent, etc.), where an instance didn't previously exist.

This sounds probable because after the second instance is created, a third
instance is not created. That is, once the Singleton exists in each scope,
it continues to work as it was designed.


On 9/9/07 12:22 AM, "Helmut Granda" <[EMAIL PROTECTED]> wrote:

> I have 5 applications and one of them was created with the Singleton
> pattern, those 5 apps are being loaded at different times into a container,
> when any of the movies is loaded and unloaded everything works fine but
> everytime the movie with the Singleton pattern is loaded into the container
> it creates a new copy of itself. one way to see that is creating a static
> counter variable that increases everytime the movie is loaded into the
> container.
> 
> Could some one point me to a site where I could understand why this is
> happening. I understand what is going on but I can't grasp the reasoning
> behind it so that I can avoid those duplicates.


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to