Search code examples
flashactionscript-3

How can I assign event.currentTarget to a variable?


I want to use multiple images in my flash script and instead of writing tons of code I want to get the 'currentTarget' and assign a variable name to it so I can tweenlite it . Instead of me naming all the instances I thought the following would work but it doesn't. Can anybody give me some pointers , thanks

wedding.addEventListener(MouseEvent.ROLL_OVER, pan_over);

function pan_over(e: MouseEvent): void {
  var ct: string = Event.currentTarget.name;

  TweenLite.to(ct, 1, {
    scaleX: 1.4,
    scaleY: 1.03
  });
}

Solution

  • try this:

        wedding.addEventListener(MouseEvent.ROLL_OVER, pan_over) ;
    
        function pan_over(e:MouseEvent):void{
           TweenLite.to(e.currentTarget, 1, {scaleX:1.4, scaleY:1.03} ) ;
        }