code:
//this is on frame 1
MovieClip.prototype.doTween = function() {
// get elapsed time in milliseconds
var elapsedTime = getTimer()-this.startTime;
// convert to easing ratio 0-1
var k = elapsedTime/this.duration;
if (k>1) {
// are we done yet?
k = 1;
delete this.onEnterFrame;
if(this.func){func();}
}
// apply easing
k = k*k*(3-2*k);
// apply easing
// perform the tween
this[this.prop]= this.startS+(this.deltaS*k);
trace(this[this.prop]);
};
MovieClip.prototype.startTween = function(targProp, targ, seconds, func) {
// get start time, in milliseconds
this.startTime = getTimer();
// compute duration in milliseconds
this.duration = seconds*1000;
//store reference to func
if(typeof func == "function" && func != null && func != undefined){
this.func = func;
}
//store _property to change
this.prop = targProp;
// get start and end values
this.startS = this[targProp];
this.targ = targ;
// compute the difference (the 'delta')
this.deltaS = this.targetS-this.startS;
// begin tweening
this.onEnterFrame = this.doTween;
};
oval_mc._alpha = 30;
//this is on frame 2
oval_mc.startTween('_alpha', 100, 1.5, undefined);
stop();