Tuesday, June 10, 2008

AS3 Tween Class

The tween class is pretty much the same as it was in AS2. When you import everything, you just have to change 'mx' to 'fl'. Also if you want to do a tween event you have to import TweenEvent:

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

var tw1:Tween = new Tween(object,"x",Strong.easeOut,start,end,time,true);

If you want to do an event (like the old onMotionFinished), it's a little different now. You have to create an event listener like this:
tw1.addEventListener(TweenEvent.MOTION_STOP, tweenStop);
function tweenStop(event:TweenEvent):void{
var tw2:Tween = new Tween(movieclip,"x",Back.easeOut,movieclip.x,300,1,true);

1 comment:

Matt said...

Thanks for your help. Looks like we are both making progress on AS3