View comments | RSS feed

ColorTransform (flash.geom.ColorTransform)


Object
    |
    +-flash.geom.ColorTransform

public class ColorTransform
extends Object

The ColorTransform class lets you mathematically adjust all of the color values in a movie clip. The color adjustment function or color transformation can be applied to all four channels: red, green, blue, and alpha transparency.

When a ColorTransform object is applied to a movie clip, a new value for each color channel is calculated like this:

If any of the color channel values is greater than 255 after the calculation, it is set to 255. If it is less than 0, it is set to 0.

You must use the new ColorTransform() constructor to create a ColorTransform object before you can call the methods of the ColorTransform object.

Color transformations do not apply to the background color of a movie clip (such as a loaded SWF object). They apply only to graphics and symbols that are attached to the movie clip.

Availability: ActionScript 1.0; Flash Player 8

See also

colorTransform (Transform.colorTransform property)

Property summary

Modifiers

Property

Description

 

alphaMultiplier:Number

A decimal value that is multiplied by the alpha transparency channel value.

 

alphaOffset:Number

A number from -255 to 255 that is added to the alpha transparency channel value after it has been multiplied by the alphaMultiplier value.

 

blueMultiplier:Number

A decimal value that is multiplied by the blue channel value.

 

blueOffset:Number

A number from -255 to 255 that is added to the blue channel value after it has been multiplied by the blueMultiplier value.

 

greenMultiplier:Number

A decimal value that is multiplied by the green channel value.

 

greenOffset:Number

A number from -255 to 255 that is added to the green channel value after it has been multiplied by the greenMultiplier value.

 

redMultiplier:Number

A decimal value that is multiplied by the red channel value.

 

redOffset:Number

A number from -255 to 255 that is added to the red channel value after it has been multiplied by the redMultiplier value.

 

rgb:Number

The RGB color value for a ColorTransform object.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Constructor summary

Signature

Description

ColorTransform([redMultiplier:Number], [greenMultiplier:Number], [blueMultiplier:Number], [alphaMultiplier:Number], [redOffset:Number], [greenOffset:Number], [blueOffset:Number], [alphaOffset:Number])

Creates a ColorTransform object for a display object with the specified color channel values and alpha values.

Method summary

Modifiers

Signature

Description

 

concat(second:ColorTransform) : Void

Applies a second, additive color transformation to the movie clip.

 

toString() : String

Formats and returns a string that describes all of the properties of the ColorTransform object.

Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

Comments


No screen name said on Oct 17, 2005 at 7:19 AM :
Applying "ColorTransform" to the movie clip (some simple shape) with "bevel" filter applied removes all visual effects of the filter. Why?

Code:

var current_transform = new Transform(_theMovieClip);
var current_color = new ColorTransform();
current_color.rgb = 0xFF0000;
current_transform.colorTransform = current_color;
No screen name said on Dec 19, 2005 at 7:16 AM :
It doesnt seem to matter if you use the Color or ColorTransform object. As soon as you change the color with either of these, any filters you have already applied (or are goint to apply) will not work.
eerkmans said on Nov 8, 2006 at 1:56 AM :
can you use colorTransform to adjust an image's saturation?
nads said on Jul 17, 2007 at 2:49 AM :
I had problems with the color object, saw it was deprecated, and so started using the ColorTransform object. However, that produced a different bug:

I transform a movieclip to a random colour, then let the movieclip animate in a loop. After the first loop, the movieclip reverts to its old colour. What's going on, and how can I fix it?
nads said on Jul 17, 2007 at 2:59 AM :
gotoAndPlay seems to reset the colour of the movie, i.e. overwrite any previously applied ColorTransform Objects!? Any fix for this?

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002083.html