5 Replies Latest reply on Oct 23, 2007 5:05 PM by kglad

    addEventListener

    Mithrandirself Level 1
      ActionScript 3:

      Hello, I'm looking to create a single function to handle event calls dynamically however I have been running into some syntax brick walls due to my inexperience with the language.

      Here is the function I would like to use:

      function gotoFrame(Event:MouseEvent,FrameNumber:Number):void {
      gotoAndStop(FrameNumber);
      }

      This would allow me to pass a number (FrameNumber) which can be used to move the timeline to a frame defined in the function call. However the addEventListener method seems overly strict in its definition.

      btnChapters.addEventListener (MouseEvent.CLICK, gotoFrame);


      How can I pass the extra parameter of "gotoFrame" to my function?


      Or, is there some way to use the "this" operator to find the name of the clicked button, I noticed the MouseEvent object contains every conceiveable peice of information in relation to the mouse click, other than the object that click activated.