Flash.geom.ColorTransform
-
You can use the ColorTransform class to adjust the color values of the display object. You can apply color adjustment or
color conversion to all four channels: red, green, blue, and Alpha transparency.
When the ColorTransform object is applied to the display object, the new value is calculated for each color channel as follows:
- New Red value = (Old red value * redmultiplier) + Redoffset
- New Green value = (old green value * greenmultiplier) + Greenoffset
- New Blue value = (Old blue value * bluemultiplier) + Blueoffset
- New Alpha value = (old alpha value * alphamultiplier) + Alphaoffset
If any one of the color channel values is greater than 255 after the calculation, the value is set to 255. If the value is less than 0, it is set to 0.
You can use the ColorTransform object in the following ways:
- In the ColorTransform parameter of the ColorTransform () method of the BitmapData class
- The ColorTransform property as a Transform object (this object can be used as the Transform property of the display object)
You must use the new ColorTransform () constructor to create a ColorTransform object before you can invoke the methods of the ColorTransform object.
Color transformations are not applied to the background color of movie clips, such as loaded SWF objects, and they apply only to graphics and symbols attached to a movie clip.
Simple example:
var New = 0xffff00= ct;
[ActionScript 3.0] Dynamically change the color of a movie clip