Skip to main content
Inspiring
October 25, 2006
Question

addListener() vs. addEventListener()

  • October 25, 2006
  • 2 replies
  • 8381 views
I'm going through a set of tutorials, and where in the past I have used addListener to specify an object as an event listener, a new tutorial is asking me to use addEventListener().

The differrence is that addListener() requires only one parameter - the object that will be the listener. addEventListener also requires a string which is the name of the event that will be triggered. When I am listening for multiple events, this would necessitate multiple listeners - a big pain.

So - here's my question. Is there any application where addListener() just won't work, so I should deffinately use addEventListener()? Also, since addEventListener() is both more limited in function and more code intensive, is there any advantage it has over addListener()?

thanks!
This topic has been closed for replies.

2 replies

DZ-015Author
Inspiring
October 26, 2006
ok - i see... but question... could I still use addListener() for components...?

or is it addEventListener() for components, and addListener() for everything else?
kglad
Community Expert
Community Expert
October 26, 2006
well, the button component (and movieclips in general) cannot broadcast an event. so, the following wouldn't work:

kglad
Community Expert
Community Expert
October 26, 2006
addEventListener() is a component method. addListener is a method of a few classes (not including movieclips) that can broadcast events.