Event handling in AS2 - addListeners and addEventListeners

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cameokid
    New Member
    • Feb 2008
    • 10

    Event handling in AS2 - addListeners and addEventListeners

    I have a doubt as to why we have addListeners and addEventListene rs in AS2.

    At times addListeners works and at times addEventListene rs does the job.

    Can some one please differenciate as to when addListener is to be used and when addEventListene r?

    To addup to the confusion, we have event handlers directly linked to objects such as movie clips

    e.g. obj_mc.onPress

    So when do we use the right event handling method?
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    Originally posted by cameokid
    I have a doubt as to why we have addListeners and addEventListene rs in AS2.

    At times addListeners works and at times addEventListene rs does the job.

    Can some one please differenciate as to when addListener is to be used and when addEventListene r?

    To addup to the confusion, we have event handlers directly linked to objects such as movie clips

    e.g. obj_mc.onPress

    So when do we use the right event handling method?

    Well, reading on this adobe site it basically says that the "on(event)" syntax is not supported in AS3, because the addeventlistene r replaces it, so in AS2 you can still use the .onPress method, it seems like it theres no problem, it's just been replaced with AddEventListene r in AS3....does that help you?

    joedeene

    Comment

    • cameokid
      New Member
      • Feb 2008
      • 10

      #3
      Originally posted by joedeene
      Well, reading on this adobe site it basically says that the "on(event)" syntax is not supported in AS3, because the addeventlistene r replaces it, so in AS2 you can still use the .onPress method, it seems like it theres no problem, it's just been replaced with AddEventListene r in AS3....does that help you?

      joedeene

      Yes joedeene. What you say is true. AddEventListene r resolves all the event handling issues in AS3.
      But i am currently working on AS2 and am confused about the event handling methodology used in it. Hence i am looking out for differences among on(event), addListener and addEventListene r.

      Comment

      • joedeene
        Contributor
        • Jul 2008
        • 579

        #4
        I've been searching Google some more and basically, I think that the addListener and addEventListene r are just the successor syntaxes for on(event) in AS2. So, I would just use the on(event) syntax.

        joedeene

        Comment

        Working...