I have a simple code to implement a “tint” effect on a DisplayObject:
/**
* Tints an object by a certain amount.
* @usage Display.tint(playerShadow, 0x000000, 0.9)
* @param object the object to have it's color changed
* @param color the desired color
* @param alpha the amount to be tintet, being 0 no change and 1 completely painted
*/
public static function tint(object:DisplayObject, color:uint, alpha:Number=1):void {
var tintColor:ColorTransform = object.transform.colorTransform
tintColor.color = color
tintColor.alphaMultiplier = alpha
object.transform.colorTransform = tintColor
}
It used to work perfectly, tinting the correct amount and all. But today it doesn’t work anymore.
I did not update the flash player, or flash IDE and even when testing in the browser the same problem appears.
It seems that the tint is completely overriding the object’s colors. I.e.: if I tint a green square with any amount of black, I’ll have a black square with the same alpha as the tint’s. And it is actually transparent, it’s possible to see what’s behind and all, regardless of the original object having any transparency or not.
Why isn’t it working? And why did it STOP working so abruptly?