I just read about it on another site.
Seems to be the only solution, to store it in a variable.
-that is a little to bad really, but I guess I have to live with that.

Thanks for your answers.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Helen
Triolo
Sent: den 27 oktober 2005 15:20
To: Flashcoders mailing list
Subject: Re: [Flashcoders] removeEventListener not working?

You have to store a reference to the delegate to be able to remove it.  
A modification of a post by Till S:

function clearListeners():Void {
   fntController.removeEventListener('onFinished', fdelegate);
}
var fdelegate = Delegate.create(this, fontsLoaded);
fntController.addEventListener('onFinished', fdelegate);

cleanListeners();

Helen


Martin Klasson wrote:

>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
>  
>

_______________________________________________
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