Nicolas W.
Nicolas W.

Reputation: 672

removeEventListener seems to not remove the listener

I wrote this actionscript code:

trace("before remove: " +
    donneesTechniques.hasEventListener(DonneesTechniques.INITIALISATION) );
donneesTechniques.removeEventListener(DonneesTechniques.INITIALISATION, init);
trace("after remove: " +
    donneesTechniques.hasEventListener(DonneesTechniques.INITIALISATION) );

the output of this code is:

before remove: true
after remove: true

How is that possible? The donneesTechniques component has a lister for the INITIALISATION event but it seems not to remove it...

I checked the memory addresses of this component through the code and it is always the same address. So there is no remove on another object. removeEventListener does not have any effect if the listener is not found but in my case there is one (according to hasEventListener())

Upvotes: 0

Views: 822

Answers (1)

Constantiner
Constantiner

Reputation: 14221

According to hasEventListener() there is at least one listener. So it is very possible if some other component subscribed this event too and is still subscribed after you removed a listener in current object.

Upvotes: 1

Related Questions