Posted By

_mantra on 07/01/10


Tagged

actionscript event flash as3 listeners


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

davidino1978
dubogii
Josueriv


Actionscript 3 Simple Event Listeners


 / Published in: ActionScript 3
 

simple how-to adding an event listener to a button or movieClip and trace the target name.

  1. btn.addEventListener(MouseEvent.MOUSE_CLICK, clickHandler);
  2.  
  3. function clickHandler(e:MouseEvent):void {
  4. var obj = e.target.name;
  5. trace(obj)
  6. }

Report this snippet  

You need to login to post a comment.