The trouble is that Delegate.create _creates a new Function object_ - so the
Delegate object in your removeEventListener call is actually a different
object from in your addEventListener call.
To get around this, simply store the delegate - e.g.:
var myDelegate:Function=Delegate.create(this,fontsLoaded);
// ADD
fntController.addEventListener('onFinished',myDelegate);
// REMOVE
fntController.removeEventListener('onFinished',myDelegate);
On 10/27/05, Martin Klasson <[EMAIL PROTECTED]> 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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders