Tween Class

Tween class is preety smilple and very very useful. I have not used it till last month and after using it I always think that If I had spend 1hr on this class before 2 years, Icould make many application more interesting. (Specially some Drag & Drops)

Here is one example of Tween Class.

You need to put one movieClip named “mcObject” on Stage and paste the code in Action Layer.

//————– Copy from here ——————-

import mx.transitions.Tween;

import mx.transitions.easing.*;

//

var mcObject:MovieClip;

//

mcObject.onPress = pressHandler;

mcObject.onRelease = mcObject.onReleaseOutside=releaseHandler;

//

function pressHandler() {

//trace(“pressHandler called with [“+arguments+”]”);

this.oldX = this._x;

this.oldY = this._y;

this.startDrag();

}

//

function releaseHandler() {

//trace(“releaseHandler called with [“+arguments+”]”);

this.stopDrag();

var xTween:Tween = new Tween(this, “_x”, Bounce.easeOut, this._x, this.oldX, 5, true);

var yTween:Tween = new Tween(this, “_y”, Bounce.easeOut, this._y, this.oldY, 5, true);

}

//————– Stop Copying ——————-

You can take offical help on Tween class from here