Monday, September 22, 2008

Tweening with AS3

Fellow Flash Devs,

I have finally started playing with AS3 & tried doing some experimentation with Tween class.

It's as simple as before except the classes which needs to be imported are different. So for AS3 we will import fl.transitions.Tween & fl.transitions.easing.*

Please use the code below to simply animate a box kept on the stage using Tween class-

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

b1.buttonMode = true;
b1.addEventListener(MouseEvent.CLICK, btnclick);

function btnclick(event:MouseEvent)
{
new Tween(b1,"x",Regular.easeOut, b1.x, b1.x+50,1, true);
}