Hi. I am trying to carry out an actionscript colour tween and have found the following code on these forums:
////////////////////////////////////////////////////////////
doTween = function () {
var t = (getTimer()-this.startTime)/this.dur;
if (t>1) {
t = 1;
delete this.onEnterFrame;
}
var r = t*this.r2+(1-t)this.r1;
var g = tthis.g2+(1-t)this.g1;
var b = tthis.b2+(1-t)*this.b1;
this.clr.setRGB((r << 16)+(g << 8)+b);
}
MovieClip.prototype.beginColorTween = function(r1, g1, b1, r2, g2, b2, duration) {
this.r1 = r1;
this.g1 = g1;
this.b1 = b1;
this.r2 = r2;
this.g2 = g2;
this.b2 = b2;
this.dur = duration;
this.startTime = getTimer();
this.clr = new Color(this);
this.onEnterFrame = doTween;
}
////////////////////////////////////////////////////////////
My problem is, I would like to have a variable which returns the current red, green and blue values of the movie clip during the tween.
In other words, I need to define a variable for the current RGB in the middle of my AS colour tween so that the following example would tween smoothly from the current values to the target.
E.g. mc.beginColorTween(currentr, currentg, currentb, 255, 204, 0, 500);
Is this possible?
Thanks in advance for any help.