A-C > Color.setTransform
Color.setTransformSyntax
myColor
.setTransform(colorTransformObject
);
Arguments
colorTransformObject
An object created using the constructor of the generic Object object, specifying color transform values for parameters. The color transform object must have the parameters ra
, rb
, ga
, gb
, ba
, bb
, aa
, ab
, which are explained below.
Description
Method; sets color transform information for a Color object. The colorTransformObject
argument is an object that you create using the generic Object object with parameters specifying the percentage and offset values for the red, green, blue, and alpha (transparency) components of a color, entered in a 0xRRGGBBAA format.
The parameters for a color transformobject are defined as follows:
![]() |
ra is the percentage for the red component (-100 to 100). |
![]() |
rb is the offset for the red component (-255 to 255). |
![]() |
ga is the percentage for the green component (-100 to 100). |
![]() |
gb is the offset for the green component (-255 to 255). |
![]() |
ba is the percentage for the blue component (-100 to 100). |
![]() |
bb is the offset for the blue component (-255 to 255). |
![]() |
aa is the percentage for alpha (-100 to 100). |
![]() |
ab is the offset for alpha (-255 to 255). |
You create a color transformobject as follows:
myColorTransform = new Object();
myColorTransform.ra = 50;
myColorTransform.rb = 244;
myColorTransform.ga = 40;
myColorTransform.gb = 112;
myColorTransform.ba = 12;
myColorTransform.bb = 90;
myColorTransform.aa = 40;
myColorTransform.ab = 70;
You could also use the following syntax:
myColorTransform = { ra: '50', rb: '244', ga: '40', gb: '112', ba: '12', bb: '90', aa: '40', ab: '70'}
Player
Flash 5 or later.
Example
The following example shows the process of creating a new Color object for a target movie, creating a color transformobject with the parameters defined above using the Object constructor, and passing the color transform object to a Color object using the setTransform
method.
//Create a color object called myColor for the target myMovie
myColor = new Color(myMovie);
//Create a color transform object called myColorTransfrom using
//the generic Object object
myColorTransform = new Object;
// Set the values for myColorTransform
myColorTransform = { ra: '50', rb: '244', ga: '40', gb: '112', ba: '12', bb: '90', aa: '40', ab: '70'}
//Associate the color transform object with the Color object created for myMovie
myColor.setTransform(myColorTransform);