Does your font loader load differen fonts for different client objects and the font loader is just a utility class for loading fonts ?
I need to know that to help you revise the design.. Grant ----- Original Message ----- From: Alan Shaw [EMAIL PROTECTED] To: Flashcoders mailing list [email protected] Sent: 10/27/05 3:29 PM Subject: Re: [Flashcoders] Singleton and Listeners is a bad combination > On 10/27/05, Martin Klasson wrote: > > > > > > I got a class which I thought would be improved by using the Singleton > > pattern. And it does, until I am adding in the EventDispatcher. > > > > The problem is that my application will using the FontLoader.getInstance() > > at several places in different classes and files. > > > > The problem arises since you can set addEventListeners to the instance. > > > > > > > > If you in class A has: > > > > fntController = FontLoader.getInstance() > > > > fntController.addEventListener('onFinished', fontsLoaded) > > > > > > > > And in Class B you have the same as class A, just to state an example of > > the problem... > > > > > > > > The problem is that since FontLoader.getInstance() returns exactly the > > same instance everytime. So when class B fontsLoaded is called, the > > fontsLoaded is also called in class A. > > > One solution may be to have your fontsLoaded methods > examine the event object that is passed to see if it is the one > they want to respond to. You could probably come up with other > solutions by examining the documentation :) > > -A > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

