
Color.setTransform() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
500
|
ActionScript Language Reference
// Create the Color object
var boxColor = new Color("box");
// Set the color of box to the RGB triplet (R:201, G:160, B:21)
boxColor.setRGB(combineRGB(201, 160, 21));
The following example adds a convenient setRGB() method to all movie clips. It automati-
cally creates the necessary Color object and then calls the Color.setRGB() method:
MovieClip.prototype.setRGB = function (colorValue) {
new Color(this).setRGB(colorValue);
};
// Usage:
theClip_mc.setRGB(0xFF0000); // Set theClip_mc's color to red
See Also
Color.getRGB(), Color.setTransform()
Color.setTransform() Method
assign new offset and/or percentage values for Red, Green, Blue, and Alpha
Flash 5
colorObj.setTransform(transformObject)
Arguments
transformObject
An object whose properties contain the new color transformation values for
the target clip of
colorObj.
Description
The setTransform() method gives us precise control over the percentage and offset of the
Red, Green, Blue, and Alpha components of a movie clip’s color. To use setTransform(),
we must first create an object (normally an instance of the Object class) with a series of
predefined properties. The transformation we wish to apply to our Color object is
expressed using those properties, which are listed in Table R-5 ...