Name
Color.setTransform( ) Method — assign new offset and/or percentage values for Red, Green, Blue, and Alpha
Availability
Flash 5
Synopsis
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
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 20.4 for the
getTransform( )
method (except that
setTransform( )
specifies their values rather
than reading their values).
Once we have created an object with the properties described in Table 20.4, we pass that object to the
setTransform( )
method. The values of the
properties on our transformObject
become
the new offset and percentage transform values of
colorObj
and, hence,
colorObj
’s target movie clip. The
final color values in the clip are then determined according to the
calculation discussed under the Color
class.
To examine the current offsets and percentages of a particular
Color
object, we use the getTransform(
)
method.
Example
// Create a new Color object for the box clip boxColor = new Color("box"); // Create a new anonymous object and store it in boxTransform boxTransform = new Object( ); // Assign ...
Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.