- Home
- Tutorials
- Flash
- Intermediate
- Tint Animation, BindColor and RGBColor classes
Tint Animation, BindColor and RGBColor classes

Animating the Tint
Amen KAMALELDINE
Amen is an industrial informatics engineer. he studied the first four years of his education in Faculty of Engineering in Lebanon. He went to France to Continue his studies by doing the fifth year of engineering and the master TIS (Technologie Information et Système) in the same time at UTC (Université de Technologie de Compiègne). He also work as a freelancer in flash development field. He is always interessted in the new multimedia technologies.
View all articles by Amen KAMALELDINEScript
import com.core.*;
//declare an rgbColor object for the movieclip backgroun
var rgbColor:RGBColor = new RGBColor();
//and another one for the text
var textRGBColor:RGBColor = new RGBColor();
//attach it to the mc
rgbColor.attachTo(my_mc);
//and this to the text mc
textRGBColor.attachTo(tintText);
//function to perform the tweening of a property of an object
//--------function used to all effects-------------
function tween(_mc, easeType, type, begin, end, time, bool, mcf, functionToCall, param) {
var myTween;
myTween = new mx.transitions.Tween(_mc, type, easeType, begin, end, time, bool);
myTween.functionToCall = functionToCall;
myTween.param = param;
myTween.mcf = mcf;
myTween.onMotionFinished = function() {
this.mcf[functionToCall](this.param);
};
return myTween;
}
//Animate the tint
function randomTint() {
var max = 255;
var time = 1.2;
//change the red green blue values of the textRGBColoer
tween(textRGBColor, mx.transitions.easing.Regular.easeOut, 'red', textRGBColor.red, random(max), time, true);
tween(textRGBColor, mx.transitions.easing.Regular.easeOut, 'green', textRGBColor.green, random(max), time, true);
tween(textRGBColor, mx.transitions.easing.Regular.easeOut, 'blue', textRGBColor.blue, random(max), time, true);
tween(rgbColor, mx.transitions.easing.Regular.easeOut, 'red', rgbColor.red, random(max), time, true);
tween(rgbColor, mx.transitions.easing.Regular.easeOut, 'green', rgbColor.green, random(max), time, true);
tween(rgbColor, mx.transitions.easing.Regular.easeOut, 'blue', rgbColor.blue, random(max), time, true,this,'randomTint');
}
randomTint();
And thats it after last tween is done we recall the randomTint function to animate to some new Values.
Thanks for reading, and if you have any questions the forums is always opened for you ;)
Amen.

