XColorTransform (com.robertpenner.graphics.XColorTransform)

ColorTransform
        |
        +--com.robertpenner.graphics.XColorTransform
class XColorTransform
extends ColorTransform

The XColorTransform class extends the ColorTransform class adding a collection of utilities that allows for more intuitive color manipulation.

Availability:

ActionScript 2.0; Flash Player 8

Property summary

Property Description
rgb:Number

The rgb property of the XColorTransform object.

redOffset:Number

The redOffset property of the XColorTransform object.

greenOffset:Number

The greenOffset property of the XColorTransform object.

blueOffset:Number

The blueOffset property of the XColorTransform object.

alphaOffset:Number

The alphaOffset property of the XColorTransform object.

redMultiplier:Number

The redMultiplier property of the XColorTransform object.

greenMultiplier:Number

The greenMultiplier property of the XColorTransform object.

blueMultiplier:Number

The blueMultiplier property of the XColorTransform object.

alphaMultiplier:Number

The alphaMultiplier property of the XColorTransform object.

rgbStr:String

The rgbStr property of the XColorTransform object.

brightness:Number

The brightness property of the XColorTransform object.

brightOffset:Number

The brightOffset property of the XColorTransform object.

negative:Number

The negative property of the XColorTransform object.

red:Number

The red property of the XColorTransform object.

green:Number

The green property of the XColorTransform object.

blue:Number

The blue property of the XColorTransform object.

redPercent:Number

The redPercent property of the XColorTransform object.

greenPercent:Number

The greenPercent property of the XColorTransform object.

bluePercent:Number

The bluePercent property of the XColorTransform object.

Method summary

Method Description
setRGBStr(hexStr:String) : Void

Specifies an RGB color for an XColorTransform object using a string hexadecimal value.

getRGBStr() : String

Returns the R+G+B combination currently in use by the XColorTransform object as a string hexadecimal value.

setRGB2(r:Number, g:Number, b:Number) : Void

Specifies an RGB color for an XColorTransform object using individual red, green, and blue values.

getRGB2() : Object

Returns the R+G+B values currently in use by the XColorTransform object as individual red, green, and blue values.

reset() : Void

Sets the color transform for an XColorTransform object to its default values.

setBrightness(bright:Number) : Void

Specifies the brightness of an XColorTransform object.

getBrightness() : Number

Returns the brightness of an XColorTransform object.

setBrightOffset(offset:Number) : Void

Pushes an XColorTransform object towards black or white by an absolute amount.

getBrightOffset() : Number

Returns the brightness offset value of an XColorTransform object.

setTint(r:Number, g:Number, b:Number, percent:Number) : Void

Tints an XColorTransform object with a color according to a certain percentage.

getTint() : Object

Returns the tint of an XColorTransform object.

setTint2(rgb:Number, percent:Number) : Void

Tints an XColorTransform object with a color according to a certain percentage.

getTint2() : Object

Returns the tint of an XColorTransform object.

setTintOffset(r:Number, g:Number, b:Number) : Void

Tints an XColorTransform object with a color according to red, green, and blue values.

getTintOffset() : Object

Returns the tint offset of an XColorTransform object.

setTintOffset2(rgb:Number) : Void

Tints an XColorTransform object with a color according to an rgb value.

getTintOffset2() : Number

Returns the tint offset of an XColorTransform object.

invert() : Void

Performs a straightforward color inversion.

setNegative(percent:Number) : Void

Inverts an XColorTransform object by a certain percentage.

getNegative() : Number

Returns the negative percentage of an XColorTransform object.

setRed(amount:Number) : Void

Specifies a red color value for an XColorTransform object.

getRed() : Number

Returns the red color value of an XColorTransform object.

setGreen(amount:Number) : Void

Specifies a green color value for an XColorTransform object.

getGreen() : Number

Returns the green color value of an XColorTransform object.

setBlue(amount:Number) : Void

Specifies a blue color value for an XColorTransform object.

getBlue() : Number

Returns the blue color value of an XColorTransform object.

setRedPercent(percent:Number) : Void

Specifies a red percentage value for an XColorTransform object.

getRedPercent() : Number

Returns the red percentage value of an XColorTransform object.

setGreenPercent(percent:Number) : Void

Specifies a green percentage value for an XColorTransform object.

getGreenPercent() : Number

Returns the green percentage value of an XColorTransform object.

setBluePercent(percent:Number) : Void

Specifies a blue percentage value for an XColorTransform object.

getBluePercent() : Number

Returns the blue percentage value of an XColorTransform object.

toString() : String

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

concat(second:ColorTransform) : Void

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

setRGBStr(hexStr:String) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRGBStr("#FFFF00");
my_trans.colorTransform = my_colorTrans;

Parameters

hexStr:String - The string hexadecimal color to be set.

Returns

Nothing.

Description

Specifies an RGB color for an XColorTransform object using a string hexadecimal value.


getRGBStr() : String

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
trace (my_colorTrans.getRGBStr());

Parameters

Returns

The string hexadecimal color.

Description

Returns the R+G+B combination currently in use by the XColorTransform object as a string hexadecimal value.


setRGB2(r:Number, g:Number, b:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRGB2(255, 0, 255);
my_trans.colorTransform = my_colorTrans;

Parameters

r:Number - The red color value.

g:Number - The green color value.

b:Number - The blue color value.

Returns

Nothing.

Description

Specifies an RGB color for an XColorTransform object using individual red, green, and blue values.


getRGB2() : Object

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRGB2(255, 0, 255);
my_trans.colorTransform = my_colorTrans;
var rgb:Object = my_colorTrans.getRGB2();
trace (rgb.r);
trace (rgb.g);
trace (rgb.b);

Parameters

Returns

The RBG value object with r, g, and b properties.

Description

Returns the R+G+B values currently in use by the XColorTransform object as individual red, green, and blue values.


reset() : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.rgb = 0x0000FF;
my_trans.colorTransform = my_colorTrans;
my_colorTrans.reset();
my_trans.colorTransform = my_colorTrans;

Parameters

Returns

Nothing.

Description

Sets the color transform for an XColorTransform object to its default values.


setBrightness(bright:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBrightness(50);
my_trans.colorTransform = my_colorTrans;

Parameters

bright:Number - A percentage value between -100 and 100. Positive values brighten the color. and negative values darken it.

Returns

Nothing.

Description

Specifies the brightness of an XColorTransform object.


getBrightness() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBrightness(50);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getBrightness());

Parameters

Returns

The brightness value.

Description

Returns the brightness of an XColorTransform object.


setBrightOffset(offset:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBrightOffset(140);
my_trans.colorTransform = my_colorTrans;

Parameters

offset:Number - A number between -255 and 255. Positive values push colors towards white; negative values towards black.

Returns

Nothing.

Description

Pushes an XColorTransform object towards black or white by an absolute amount.


getBrightOffset() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBrightOffset(140);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getBrightOffset());

Parameters

Returns

The brightness offset value.

Description

Returns the brightness offset value of an XColorTransform object.


setTint(r:Number, g:Number, b:Number, percent:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTint(0, 0, 128, 50);
my_trans.colorTransform = my_colorTrans;

Parameters

r:Number - The red color value.

g:Number - The green color value.

b:Number - The blue color value.

percent:Number - The tint percentage.

Returns

Nothing.

Description

Tints an XColorTransform object with a color according to a certain percentage.


getTint() : Object

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTint(0, 0, 128, 50);
my_trans.colorTransform = my_colorTrans;
var tint:Object = my_colorTrans.getTint();
trace (tint.r);
trace (tint.g);
trace (tint.b);
trace (tint.percent);

Parameters

Returns

The tint value object with r, g, b, and percent properties.

Description

Returns the tint of an XColorTransform object.


setTint2(rgb:Number, percent:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTint2(0x0000FF, 100);
my_trans.colorTransform = my_colorTrans;

Parameters

rgb:Number - The rgb value.

percent:Number - The tint percentage.

Returns

Nothing.

Description

Tints an XColorTransform object with a color according to a certain percentage.


getTint2() : Object

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTint2(0x0000FF, 100);
my_trans.colorTransform = my_colorTrans;
var tint:Object = my_colorTrans.getTint2();
trace (tint.rgb);
trace (tint.percent);

Parameters

Returns

The tint value object with rgb and percent properties.

Description

Returns the tint of an XColorTransform object.


setTintOffset(r:Number, g:Number, b:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTintOffset(0, 0, 128);
my_trans.colorTransform = my_colorTrans;

Parameters

r:Number - The red color value.

g:Number - The green color value.

b:Number - The blue color value.

Returns

Nothing.

Description

Tints an XColorTransform object with a color according to red, green, and blue values.


getTintOffset() : Object

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTintOffset(0, 0, 128);
my_trans.colorTransform = my_colorTrans;
var tint:Object = my_colorTrans.getTintOffset();
trace (tint.r);
trace (tint.g);
trace (tint.b);

Parameters

Returns

The tint offset value object with r, g, and b properties.

Description

Returns the tint offset of an XColorTransform object.


setTintOffset2(rgb:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTintOffset2(0x000080);
my_trans.colorTransform = my_colorTrans;

Parameters

rgb:Number - The rgb value.

Returns

Nothing.

Description

Tints an XColorTransform object with a color according to an rgb value.


getTintOffset2() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setTintOffset2(0x000080);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getTintOffset2());

Parameters

Returns

The tint offset value object with an rgb properties.

Description

Returns the tint offset of an XColorTransform object.


invert() : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.invert();
my_trans.colorTransform = my_colorTrans;

Parameters

Returns

Nothing.

Description

Performs a straightforward color inversion.


setNegative(percent:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setNegative(60);
my_trans.colorTransform = my_colorTrans;

Parameters

percent:Number - The negative percentage.

Returns

Nothing.

Description

Inverts an XColorTransform object by a certain percentage.


getNegative() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setNegative(60);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getNegative());

Parameters

Returns

The negative percentage.

Description

Returns the negative percentage of an XColorTransform object.


setRed(amount:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRed(128);
my_trans.colorTransform = my_colorTrans;

Parameters

amount:Number - The red color value.

Returns

Nothing.

Description

Specifies a red color value for an XColorTransform object.


getRed() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRed(128);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getRed());

Parameters

Returns

The red color value.

Description

Returns the red color value of an XColorTransform object.


setGreen(amount:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setGreen(128);
my_trans.colorTransform = my_colorTrans;

Parameters

amount:Number - The green color value.

Returns

Nothing.

Description

Specifies a green color value for an XColorTransform object.


getGreen() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setGreen(128);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getGreen());

Parameters

Returns

The green color value.

Description

Returns the green color value of an XColorTransform object.


setBlue(amount:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBlue(128);
my_trans.colorTransform = my_colorTrans;

Parameters

amount:Number - The blue color value.

Returns

Nothing.

Description

Specifies a blue color value for an XColorTransform object.


getBlue() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBlue(128);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getBlue());

Parameters

Returns

The blue color value.

Description

Returns the blue color value of an XColorTransform object.


setRedPercent(percent:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRedPercent(50);
my_trans.colorTransform = my_colorTrans;

Parameters

percent:Number - The red percentage value.

Returns

Nothing.

Description

Specifies a red percentage value for an XColorTransform object.


getRedPercent() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setRedPercent(50);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getRedPercent());

Parameters

Returns

The red percentage value.

Description

Returns the red percentage value of an XColorTransform object.


setGreenPercent(percent:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setGreenPercent(50);
my_trans.colorTransform = my_colorTrans;

Parameters

percent:Number - The green percentage value.

Returns

Nothing.

Description

Specifies a green percentage value for an XColorTransform object.


getGreenPercent() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setGreenPercent(50);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getGreenPercent());

Parameters

Returns

The green percentage value.

Description

Returns the green percentage value of an XColorTransform object.


setBluePercent(percent:Number) : Void

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBluePercent(50);
my_trans.colorTransform = my_colorTrans;

Parameters

percent:Number - The blue percentage value.

Returns

Nothing.

Description

Specifies a blue percentage value for an XColorTransform object.


getBluePercent() : Number

Usage


var my_colorTrans:XColorTransform = new XColorTransform();
var my_trans:Transform = new Transform(my_mc);
my_colorTrans.setBluePercent(50);
my_trans.colorTransform = my_colorTrans;
trace (my_colorTrans.getBluePercent());

Parameters

Returns

The blue percentage value.

Description

Returns the blue percentage value of an XColorTransform object.


toString() : String

Usage


var my_colorTrans:XColorTransform = new XColorTransform(1, 2, 3, 4, -255, -128, 128, 255);
trace(my_colorTrans.toString());

Parameters

Returns

A string that lists all of the properties of the XColorTransform object.

Description

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


concat(second:ColorTransform) : Void

Usage


var colorTrans_1:XColorTransform = new XColorTransform(1, 1, 1, 1, 255, 0, 0, 0);
var colorTrans_2:XColorTransform = new XColorTransform(1, 1, 1, .5, 0, 0, 0, 0);
colorTrans_1.concat(colorTrans_2);
var my_trans:Transform = new Transform(my_mc);
my_trans.colorTransform = colorTrans_1;

Parameters

second:ColorTransform - A second ColorTransform object to be combined with the current XColorTransform object.

Returns

Nothing.

Description

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


rgb : Number

Usage


trace (my_colorTrans.rgb);

Description

The rgb property of the XColorTransform object.


redOffset : Number

Usage


trace (my_colorTrans.redOffset);

Description

The redOffset property of the XColorTransform object.


greenOffset : Number

Usage


trace (my_colorTrans.greenOffset);

Description

The greenOffset property of the XColorTransform object.


blueOffset : Number

Usage


trace (my_colorTrans.blueOffset);

Description

The blueOffset property of the XColorTransform object.


alphaOffset : Number

Usage


trace (my_colorTrans.alphaOffset);

Description

The alphaOffset property of the XColorTransform object.


redMultiplier : Number

Usage


trace (my_colorTrans.redMultiplier);

Description

The redMultiplier property of the XColorTransform object.


greenMultiplier : Number

Usage


trace (my_colorTrans.greenMultiplier);

Description

The greenMultiplier property of the XColorTransform object.


blueMultiplier : Number

Usage


trace (my_colorTrans.blueMultiplier);

Description

The blueMultiplier property of the XColorTransform object.


alphaMultiplier : Number

Usage


trace (my_colorTrans.alphaMultiplier);

Description

The alphaMultiplier property of the XColorTransform object.


rgbStr : String

Usage


trace (my_colorTrans.rgbStr);

Description

The rgbStr property of the XColorTransform object.


brightness : Number

Usage


trace (my_colorTrans.brightness);

Description

The brightness property of the XColorTransform object.


brightOffset : Number

Usage


trace (my_colorTrans.brightOffset);

Description

The brightOffset property of the XColorTransform object.


negative : Number

Usage


trace (my_colorTrans.negative);

Description

The negative property of the XColorTransform object.


red : Number

Usage


trace (my_colorTrans.red);

Description

The red property of the XColorTransform object.


green : Number

Usage


trace (my_colorTrans.green);

Description

The green property of the XColorTransform object.


blue : Number

Usage


trace (my_colorTrans.blue);

Description

The blue property of the XColorTransform object.


redPercent : Number

Usage


trace (my_colorTrans.redPercent);

Description

The redPercent property of the XColorTransform object.


greenPercent : Number

Usage


trace (my_colorTrans.greenPercent);

Description

The greenPercent property of the XColorTransform object.


bluePercent : Number

Usage


trace (my_colorTrans.bluePercent);

Description

The bluePercent property of the XColorTransform object.