Search code examples
actionscript-3tweenmotion

AS3 MotionTween Name


I'm trying to get the name of a motiontween in AS3.

I have many tweens that call a generic function on MOTION_FINISH.

mainContent3X = new Tween(MainContent3, "x", Strong.easeOut, MainContent3.x, 1750, 1, true);

I need to get the number/name to know what to do.

I've tried the following with no luck:

trace(event.currentTarget.toString()); trace(event.currentTarget.name);

Can't find anything on Google.

Any Ideas?


Solution

  • If you want to retrieve a reference to the target object, you could do this :

    function motionFinish(e:TweenEvent):void{
        var tween : Tween = e.target  as Tween;
        var target : Object = tween.obj;
        //do nasty stuff with the tween's target
    }
    

    see : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/Tween.html