How do I make something change colour?
Added: 31 Jan 2009. Working example for Java
The colour of an object is changed using a colour transform in the same way a coordinate transform is used to change its size and position. Colour transforms in Flash may be additive where a delta is added to the red, green, blue and alpha channels or multiplicative where the colour channels are multiplied by a given number. Both types of transform can be applied at the same time.
Additive transforms (created with int arguments) can be used to change an object from one colour to another.
new ColorTransform(-255, 255, 0, 0);
While multiplicative transforms (which use floats) are useful for changing the saturation of the colour that is currently displayed.
new ColorTransform(0.7f, 0.7f, 0.7f, 1.0f);
When the transform is applied to the colour channels of an object the final value is restricted to the range 0..255. If the transform value falls outside this range then the value is clamped at 0 or 255 so for example if you multiply a colour by minus one then this is equivalent to setting it to zero.