A-C > Color.setTransform |
![]() ![]() ![]() |
Color.setTransform
Availability
Flash Player 5.
Usage
myColor
.setTransform(colorTransformObject
);
Parameters
colorTransformObject
An object created with the new Object
constructor. This instance of the Object object must have the following properties that specify color transform values: ra
, rb
, ga
, gb
, ba
, bb
, aa
, ab
. These properties are explained below.
Returns
Nothing.
Description
Method; sets color transform information for an instance of the Color object. The colorTransformObject
parameter is a generic object that you create from the new Object
constructor. It has parameters specifying the percentage and offset values for the red, green, blue, and alpha (transparency) components of a color, entered in the format 0xRRGGBBAA.
The parameters for a color transform object correspond to the settings in the Advanced Effect dialog box and are defined as follows:
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
You create a colorTransformObject
parameter 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 can also use the following syntax to create a colorTransformObject
parameter:
myColorTransform
= { ra: '
50
', rb: '
244
', ga: '
40
', gb: '
112
', ba: '
12
', bb: '
90
', aa: '
40
', ab: '
70
'}
Example
This example creates a new instance of the Color object for a target movie, creates a generic object called myColorTransform
with the properties defined above, and uses the setTransform
method to pass the colorTransformObject
to a Color object. To use this code in a Flash (FLA) document, place it on Frame 1 on the main Timeline and place a movie clip on the Stage with the instance name myMovie
, as in the following code:
// 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);
![]() ![]() ![]() |