Well Hi Grant. My FontLoader will always download fonts which will be available through the whole application. Even loaded swf's will be able to use these fonts.
But at one point, my "host"-file might load 3 fonts. And then when "myChild.swf" loads in, it might require an additional font which should be loaded. I need eventlisteners so that I at least can know when the fonts are downloaded. And oftenly this function that will be called is containing a another function call or a gotoAndStop or similar.. So the problem is I use the Singleton. If I got the FontLoader.getInstance() in the "host.swf" and one in the "myChild.swf" they are both having listeners setup for the fontloader-instance, they will both get executed when "myChild.swf" is calling methods of the FontLoader-instance. One way is to remove the event-listeners in "host.swf" when it is done loaded. Then they wont interfere with the "myChild.swf" when it is loading any additional font. I could send you the files with the problem, it might be more obvious what the issues are. Thanks for helping out / martin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: den 28 oktober 2005 06:29 To: [email protected] Subject: Re: [Flashcoders] Singleton and Listeners is a bad combination 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 _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

