Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

addListener() vs. addEventListener()

Explorer ,
Oct 25, 2006 Oct 25, 2006
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!
TOPICS
ActionScript
8.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2006 Oct 25, 2006
addEventListener() is a component method. addListener is a method of a few classes (not including movieclips) that can broadcast events.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 25, 2006 Oct 25, 2006
ok - i see... but question... could I still use addListener() for components...?

or is it addEventListener() for components, and addListener() for everything else?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2006 Oct 26, 2006
LATEST
well, the button component (and movieclips in general) cannot broadcast an event. so, the following wouldn't work:

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines