Do superfluous calls to addEventListenter("event", thisSpecificFunction) waste resources?

Posted by Richard Haven on Stack Overflow See other posts from Stack Overflow or by Richard Haven
Published on 2010-04-06T19:40:16Z Indexed on 2010/04/06 19:43 UTC
Read the original article Hit count: 214

I have ItemRenderers that need to listen for events. When they hear an event (and when data changes), they dispatch an event with their current data value.

As item renderers are reused, each of them is going to add its callback in set data(value...)and pass the callback function in the event as well as the current data value.

So, the listener of the item renderer's bubbling event will set someEventDispatcher.addEventListener("someEvent", itemRendererEvent.callbackListener). This will happen more than once.

Does setting the same event listener on the same event for the same dispatcher waste resources? Does the displatcher see that it already has the listener?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript