On 10/27/05, Martin Klasson <[EMAIL PROTECTED]> 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

