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