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
-
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
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);
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
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
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
for you,
but I've switched to it in my projects without a hitch.
Josh Tynjala
Zeus Design
--
Date: Thu, 27 Oct 2005 15:39:17 +0200
From: Martin Klasson [EMAIL PROTECTED]
Subject: RE: [Flashcoders] removeEventListener not working?
To: Flashcoders mailing list
7 matches
Mail list logo