Okay- so when I'm calling my getInstance(); shouldn't any info I retrieve
about properties on my Singleton be the same even if they are dynamically
updated. For example- I have a class that contains a Netstream object inside
my Singleton and I wold think that from any timeline I could create a
reference--> an instance of my class -->and then request myNetStream.time.
But this just gets me a bunch of zeros despite the fact that another tracer
from within that class is tracing out all kinds of other numbers for
myNetStream time's value.

I've been having several situations where I'm wondering if I'm losing
references when another object is calling my getInstance() or something
weird like that

M


On 2/20/06, Judah <[EMAIL PROTECTED]> wrote:
>
> That's what I love about this list. The stuff I learn is invaluable. :)
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
> Sent: Monday, February 20, 2006 12:52 PM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] Re: When singletons go bad
>
> If you use getInstance(), a constructor gets called - which is often handy
> if you need to run any kind of initialisation code for your singleton
> (that
> you couldn't just do with initial property values).
>
> If you just used statics, you might end up having to do something like:
>
> public static function doSomething()
> {
>    if (!_initialised)
>    {
>       _initialiseMe();
>    }
>    // Do whatever this function is supposed to.
> }
>
> for every function that cared about the initialisation. Which is a pain.
>
> I often pre-emptively use getInstance in case I need to go back and add
> any
> sort of initialisation to a class later on. If it's clearly a utility only
> class (for example, string utilities, math utilities - just a collection
> of
> helper functions in a class) then I tend to use purely statics.
>
> Cheers,
>    Ian
>
> On 2/20/06, JesterXL <[EMAIL PROTECTED]> wrote:
> >
> > He can, but every other progammer (well, ok, mainly Java developers) are
> > familiar with the getInstance convention.  It clearly illustrates that
> the
> > class is a Singleton.
> >
> > I only use it when my boss says to; otherwise, static all the way baby.
> >
> _______________________________________________
> [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
>
> _______________________________________________
> [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
>
_______________________________________________
[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