Thanks Bryan, after I posted this yesterday I did some more testes and in
fact came out to the conclusion of what you are describing...
private function onUnload ()
{
delete Singleton
trace("deleted");
}
It works, my variables get reset (counter) but there is still one item that
is being stubborn and that is the tween class, after unloading and loading
the movie with the Singleton pattern in the next load the Tween picks fires
and also picks up a copy of the previous version... and that is what is
trowing me off. is the Tween class is being instantiated inside another
function within the class so there is not a reference of it directly on the
class... for example:
private function start()
{
var myTween:Tween = new Tween(img_mc, "_x",
mx.transitions.easing.Elastic.easeOut,0, Stage.width-img_mc._width, 3,
true);
maTween = myTween;
myTween.FPS = 30;
myTween.onMotionFinished = function() {
trace("completed");
myTween.yoyo();
};
}
any ideas in regards to this?
TIA
On 9/9/07, Bryan Thompson <[EMAIL PROTECTED]> wrote:
>
> Assuming you are storing the Singleton instance in a static class
> variable,
> unloading the movie from your container does not remove the instance from
> the class. Try setting your instance property to null when you unload the
> app (via a die() call or something similar), or detect its existence on
> load
> and handle your initialization accordingly.
>
> To help grasp the reasoning, remember that classes live in the global
> space.
> That's how you're able to call a static method or access a static property
> just by naming the Class.
>
> Makes sense?
>
> Bryan
>
> > 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.
> >
> > TIA
> >
> > --
> > ...helmut
>
>
> _______________________________________________
> [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
>
--
...helmut
_______________________________________________
[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