views:

249

answers:

2

Hi I want to use mutliple 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} ) ;
          }
+3  A: 

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} ) ;
    }
antpaw
This will work. The issue, as shortstick points out below, is that you are trying to pass a String into your TweenLite call. It's one thing to pass MyObject and another thing to pass a String that says "MyObject" - does that make sense?That said - just use e.currentTarget, there's no need to recast it as anything else.
Myk
A: 

TweenLite uses an object, not the named reference, therefore by passing to it the name MovieClip1 for example you are not passing the string but the previously constructed object. if you want to store the currentTarget for later then you should be using something like:

function pan_over(e:MouseEvent):void{
    var ct:Object = Event.currentTarget;
    TweenLite.to(ct, 1, {scaleX:1.4, scaleY:1.03} ) ;
}
shortstick