Perhaps? :

var fontsLoaded_delegate:Function = Delegate.create(this,
fontsLoaded);

fntController.addEventListener ('onFinished', fontsLoaded_delegate);

fntController.removeEventListener ('onFinished', fontsLoaded_delegate);

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin
Klasson
Sent: Thursday, October 27, 2005 9:09 AM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] removeEventListener not working?



I pasted in wrong line at the bottom, should be like this:

// ADD
fntController.addEventListener('onFinished', Delegate.create(this,
fontsLoaded));

// REMOVE DOESN'T WORK
fntController.removeEventListener('onFinished', Delegate.create(this,
fontsLoaded));


The problem is that I have used the Delegate in the addEventListener.

If I skip the Delegate on both the add and remove, then it works.
-but then I will have the wrong scope as well in the functions that gets
called ;(

So how do I remove a eventlistener when it has been added with a
delegate?

/ martin


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin
Klasson
Sent: den 27 oktober 2005 14:53
To: Flashcoders mailing list
Subject: [Flashcoders] removeEventListener not working?

 

Hi People.

 

I am using the EventDispatcher, and it works well with dispatching
events and all. But I cant remove them.

 

This is the line in which I add a listener

fntController.addEventListener('onFinished',
Delegate.create(this, fontsLoaded            ));

 

this is the line to remove it, but it doesn't work:

fntController.removeEventListener('onFinished', this)

 

The fntController-instance is available, that I have traced out and so,
so it might be a simple error in the removeEventListener, but I cant see
it.

 

/ martin

 

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to