Thank you by the looks of it I just need to import it like Troy said. I looked at a few examples of other apps and found this to be the case.
I guess singleton's would be used to store an app controller and user login info etc... Thank you all for taking the time to help me learn.. --- In flexcoders@yahoogroups.com, "Ralf Bokelberg" <[EMAIL PROTECTED]> wrote: > > The singleton pattern is dangerous, as are global variables. > The problem is, you can't reuse any of the singleton's users without using > the singleton. > I guess, that's the reason why Brett was asking for a poor man's > implementation of IoC > > Cheers, > Ralf. > > > > On 2/7/07, Troy Gilbert < [EMAIL PROTECTED]> wrote: > > > > That's usually the point of the singleton pattern, that it provides a > > global access point for a variable (as well as enforcing a single instance > > of a class). Essentially, singleton hijacks a language's type system to use > > it to deliver globals. > > > > Of course, in languages like C++ I kinda consider this on par with using > > globals and normally prefer something like a monostate object where many > > would use a singleton. But, since ActionScript doesn't actually have global > > objects, singleton is pretty useful for attaining that. > > > > Perhaps I've missed the guts of your question, but if you create a class > > that follows the singleton pattern, you'd have a "getInstance()" static > > method. To access your instance you just need to import your singleton class > > wherever you need it and then use MyClass.getInstance() to access the > > singleton. You'd have to import the class regardless if you wanted to > > *access* the singleton, so I'm not quite sure where the disconnect is in > > your question... > > > > Troy. > > > > > > On 2/6/07, rumpleminzeflickr <[EMAIL PROTECTED] > wrote: > > > > > > Hi there, > > > > > > I have a main app, with a lot of sub custom components. > > > > > > I've created a singleton class that i'm using as a controller. > > > > > > what I want to know is, do I have to define access to that singleton > > > class in every custom component, or is there some way to 'pass' the > > > instance of it down the line and make it available to all. > > > > > > Sorry if this is a dumb question, I tried searching without an answer > > > so far :( > > > > > > Brett > > > > > > > > > > > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED]> > Flex & Flash Consultant based in Cologne/Germany > Phone +49 (0) 221 530 15 35 >