User Guide
422 ActionScript classes
■ 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
colorTransformObject parameter as follows:
var myColorTransform:Object = 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:
var myColorTransform:Object = { ra: 50, rb: 244, ga: 40, gb: 112, ba: 12,
bb: 90, aa: 40, ab: 70}
Availability: ActionScript 1.0; Flash Player 5
Parameters
transformObject:Object - An object created with the new Object constructor. This
instance of the Object class must have the following properties that specify color transform
values:
ra, rb, ga, gb, ba, bb, aa, ab. These properties are explained below.
Example
This example creates a new Color object for a target SWF file, 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
my_mc, as in the following code:
// Create a color object called my_color for the target my_mc
var my_color:Color = new Color(my_mc);
// Create a color transform object called myColorTransform using
// Set the values for myColorTransform
var myColorTransform:Object = { 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 my_mc
my_color.setTransform(myColorTransform);