Mixing colors | Add 10 percent of one color to another | ActionScript 3.0 AS3

If you want to add one color to another and then set a movie clip to that tint I have provided the function below. The idea is to sort of mix colors in the way paint is mixed here is how you do it:
//requires the RGB class which can be found at the following link:
//https://gist.github.com/nicholasdunbar/8812643
//layerToTint.transform.colorTransform has to initialized to some color before this will work.
function addColorToLayer(layerToTint:DisplayObject, hexVal:String):void{
var colorTransform:ColorTransform = new ColorTransform();
var newColor:uint;
var rgb:RGB = new RGB();
var rgb2:RGB = new RGB();
var rgb3:RGB = new RGB();
rgb.r = parseInt( "0x"+hexVal.charAt(0)+hexVal.charAt(1) );
rgb.g = parseInt( "0x"+hexVal.charAt(2)+hexVal.charAt(3) );
rgb.b = parseInt( "0x"+hexVal.charAt(4)+hexVal.charAt(5) );
rgb2.r = layerToTint.transform.colorTransform.redOffset;
rgb2.g = layerToTint.transform.colorTransform.greenOffset;
rgb2.b = layerToTint.transform.colorTransform.blueOffset;
rgb3.r = int( (rgb.r*.1)+(rgb2.r*.9) );
rgb3.g = int( (rgb.g*.1)+(rgb2.g*.9) );
rgb3.b = int( (rgb.b*.1)+(rgb2.b*.9) );
// convert the new number to a hex and then an int and transform the mc
newColor = (rgb3.r << 16) | (rgb3.g << 8) | rgb3.b;
layerToTint.changeColor(newColor);
}
//for more information on this function http://www.actionscript-flash-guru.com/blog/37-mixing-colors-add-10-percent-of-one-color-to-another-actionscript-30-as3-.php
//for more information on the RGB class see http://www.actionscript-flash-guru.com/blog/36-uint-to-6-digit-rgb-hex-actionscript-30-as3.php
view raw mixColors.as hosted with ❤ by GitHub
Check out the RGB class here:
[converting RGB to 6 digit hexadecimal format.](http://www.actionscript-flash-guru.com/blog/36-uint-to-6-digit-rgb-hex-actionscript-30-as3)

layerToTint.transform.colorTransform has to initialized to some color before this will work.