ColorClip (com.robertpenner.display.ColorClip)

MovieClip
        |
        +--com.robertpenner.display.ColorClip
class ColorClip
extends MovieClip

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

Availability:

ActionScript 2.0; Flash Player 6

Property summary

Property Description
rgb:Number

The rgb property of the ColorClip.

rgbStr:String

The rgbStr property of the ColorClip.

brightness:Number

The brightness property of the ColorClip.

brightOffset:Number

The brightOffset property of the ColorClip.

negativeColor:Number

The negativeColor property of the ColorClip.

red:Number

The red property of the ColorClip.

green:Number

The green property of the ColorClip.

blue:Number

The blue property of the ColorClip.

redPercent:Number

The redPercent property of the ColorClip.

greenPercent:Number

The greenPercent property of the ColorClip.

bluePercent:Number

The bluePercent property of the ColorClip.

redOffset:Number

The redOffset property of the ColorClip.

greenOffset:Number

The greenOffset property of the ColorClip.

blueOffset:Number

The blueOffset property of the ColorClip.

Method summary

Method Description
init() : Void

Decorates all MovieClips with the methods of the XColor class.

mixin(obj:Object) : Void

Decorates a particular MovieClip instance with the methods of the XColor class.

setRGB(col:Number) : Void

Specifies an RGB color for a ColorClip object.

getRGB() : Number

Returns the R+G+B combination currently in use by the ColorClip object.

setRGBStr(hexStr:String) : Void

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

getRGBStr() : String

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

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

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

getRGB2() : Object

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

setColorTransform(trans:Object) : Void

Sets color transform information for a ColorClip object.

getColorTransform() : Object

Returns the transform value set by the last color.

resetColor() : Void

Sets the color transform for a ColorClip object to its default values.

setBrightness(bright:Number) : Void

Specifies the brightness of a ColorClip object.

getBrightness() : Number

Returns the brightness of a ColorClip object.

setBrightOffset(offset:Number) : Void

Pushes a ColorClip object towards black or white by an absolute amount.

getBrightOffset() : Number

Returns the brightness offset value of a ColorClip object.

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

Tints a ColorClip object with a color according to a certain percentage.

getTint() : Object

Returns the tint of a ColorClip object.

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

Tints a ColorClip object with a color according to a certain percentage.

getTint2() : Object

Returns the tint of a ColorClip object.

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

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

getTintOffset() : Object

Returns the tint offset of a ColorClip object.

setTintOffset2(rgb:Number) : Void

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

getTintOffset2() : Number

Returns the tint offset of a ColorClip object.

invertColor() : Void

Performs a straightforward color inversion.

setNegativeColor(percent:Number) : Void

Inverts a ColorClip object by a certain percentage.

getNegativeColor() : Number

Returns the negative percentage of a ColorClip object.

setRed(amount:Number) : Void

Specifies a red color value for a ColorClip object.

getRed() : Number

Returns the red color value of a ColorClip object.

setGreen(amount:Number) : Void

Specifies a green color value for a ColorClip object.

getGreen() : Number

Returns the green color value of a ColorClip object.

setBlue(amount:Number) : Void

Specifies a blue color value for a ColorClip object.

getBlue() : Number

Returns the blue color value of a ColorClip object.

setRedPercent(percent:Number) : Void

Specifies a red percentage value for a ColorClip object.

getRedPercent() : Number

Returns the red percentage value of a ColorClip object.

setGreenPercent(percent:Number) : Void

Specifies a green percentage value for a ColorClip object.

getGreenPercent() : Number

Returns the green percentage value of a ColorClip object.

setBluePercent(percent:Number) : Void

Specifies a blue percentage value for a ColorClip object.

getBluePercent() : Number

Returns the blue percentage value of a ColorClip object.

setRedOffset(offset:Number) : Void

Specifies a red offset value for a ColorClip object.

getRedOffset() : Number

Returns the red offset value of a ColorClip object.

setGreenOffset(offset:Number) : Void

Specifies a green offset value for a ColorClip object.

getGreenOffset() : Number

Returns the green offset value of a ColorClip object.

setBlueOffset(offset:Number) : Void

Specifies a blue offset value for a ColorClip object.

getBlueOffset() : Number

Returns the blue offset value of a ColorClip object.

init() : Void

Usage


com.robertpenner.display.ColorClip.init();

Parameters

Returns

Nothing.

Description

Decorates all MovieClips with the methods of the XColor class.


mixin(obj:Object) : Void

Usage


com.robertpenner.display.ColorClip.mixin(my_mc);

Parameters

obj:Object - The object to mix in.

Returns

Nothing.

Description

Decorates a particular MovieClip instance with the methods of the XColor class.


setRGB(col:Number) : Void

Usage


my_mc.setRGB(0x0000FF);

Parameters

col:Number - The hexadecimal or RGB color to be set.

Returns

Nothing.

Description

Specifies an RGB color for a ColorClip object.


getRGB() : Number

Usage


trace (my_mc.getRGB());

Parameters

Returns

A number that represents the RGB numeric value for the color specified.

Description

Returns the R+G+B combination currently in use by the ColorClip object.


setRGBStr(hexStr:String) : Void

Usage


my_mc.setRGBStr("#FFFF00");

Parameters

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

Returns

Nothing.

Description

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


getRGBStr() : String

Usage


trace (my_mc.getRGBStr());

Parameters

Returns

The string hexadecimal color.

Description

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


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

Usage


my_mc.setRGB2(255, 0, 255);

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 a ColorClip object using individual red, green, and blue values.


getRGB2() : Object

Usage


var rgb:Object = my_mc.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 ColorClip object as individual red, green, and blue values.


setColorTransform(trans:Object) : Void

Usage


my_mc.setColorTransform({ ra: 50, rb: 244, ga: 25, gb: 112, ba: 75, bb: 90, aa: 40, ab: 70});

Parameters

trans:Object - The transform object to be set.

Returns

Nothing.

Description

Sets color transform information for a ColorClip object.


getColorTransform() : Object

Usage


var trans:Object = my_mc.getColorTransform();
trace (trans.ra);
trace (trans.ga);
trace (trans.ba);

Parameters

Returns

An object whose properties contain the current offset and percentage values for the specified color.

Description

Returns the transform value set by the last color.


resetColor() : Void

Usage


my_mc.setRGB(0x0000FF);
my_mc.resetColor();

Parameters

Returns

Nothing.

Description

Sets the color transform for a ColorClip object to its default values.


setBrightness(bright:Number) : Void

Usage


my_mc.setBrightness(50);

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 a ColorClip object.


getBrightness() : Number

Usage


my_mc.setBrightness(50);
trace (my_mc.getBrightness());

Parameters

Returns

The brightness value.

Description

Returns the brightness of a ColorClip object.


setBrightOffset(offset:Number) : Void

Usage


my_mc.setBrightOffset(140);

Parameters

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

Returns

Nothing.

Description

Pushes a ColorClip object towards black or white by an absolute amount.


getBrightOffset() : Number

Usage


my_mc.setBrightOffset(140);
trace (my_mc.getBrightOffset());

Parameters

Returns

The brightness offset value.

Description

Returns the brightness offset value of a ColorClip object.


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

Usage


my_mc.setTint(0, 0, 128, 50);

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 a ColorClip object with a color according to a certain percentage.


getTint() : Object

Usage


my_mc.setTint(0, 0, 128, 50);
var tint:Object = my_mc.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 a ColorClip object.


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

Usage


my_mc.setTint2(0x0000FF, 100);

Parameters

rgb:Number - The rgb value.

percent:Number - The tint percentage.

Returns

Nothing.

Description

Tints a ColorClip object with a color according to a certain percentage.


getTint2() : Object

Usage


my_mc.setTint2(0x0000FF, 100);
var tint:Object = my_mc.getTint2();
trace (tint.rgb);
trace (tint.percent);

Parameters

Returns

The tint value object with rgb and percent properties.

Description

Returns the tint of a ColorClip object.


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

Usage


my_mc.setTintOffset(0, 0, 128);

Parameters

r:Number - The red color value.

g:Number - The green color value.

b:Number - The blue color value.

Returns

Nothing.

Description

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


getTintOffset() : Object

Usage


my_mc.setTintOffset(0, 0, 128);
var tint:Object = my_mc.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 a ColorClip object.


setTintOffset2(rgb:Number) : Void

Usage


my_mc.setTintOffset2(0x000080);

Parameters

rgb:Number - The rgb value.

Returns

Nothing.

Description

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


getTintOffset2() : Number

Usage


my_mc.setTintOffset2(0x000080);
trace (my_mc.getTintOffset2());

Parameters

Returns

The tint offset value object with an rgb properties.

Description

Returns the tint offset of a ColorClip object.


invertColor() : Void

Usage


my_mc.invertColor();

Parameters

Returns

Nothing.

Description

Performs a straightforward color inversion.


setNegativeColor(percent:Number) : Void

Usage


my_mc.setNegativeColor(60);

Parameters

percent:Number - The negative percentage.

Returns

Nothing.

Description

Inverts a ColorClip object by a certain percentage.


getNegativeColor() : Number

Usage


my_mc.setNegativeColor(60);
trace (my_mc.getNegativeColor());

Parameters

Returns

The negative percentage.

Description

Returns the negative percentage of a ColorClip object.


setRed(amount:Number) : Void

Usage


my_mc.setRed(128);

Parameters

amount:Number - The red color value.

Returns

Nothing.

Description

Specifies a red color value for a ColorClip object.


getRed() : Number

Usage


my_mc.setRed(128);
trace (my_mc.getRed());

Parameters

Returns

The red color value.

Description

Returns the red color value of a ColorClip object.


setGreen(amount:Number) : Void

Usage


my_mc.setGreen(128);

Parameters

amount:Number - The green color value.

Returns

Nothing.

Description

Specifies a green color value for a ColorClip object.


getGreen() : Number

Usage


my_mc.setGreen(128);
trace (my_mc.getGreen());

Parameters

Returns

The green color value.

Description

Returns the green color value of a ColorClip object.


setBlue(amount:Number) : Void

Usage


my_mc.setBlue(128);

Parameters

amount:Number - The blue color value.

Returns

Nothing.

Description

Specifies a blue color value for a ColorClip object.


getBlue() : Number

Usage


my_mc.setBlue(128);
trace (my_mc.getBlue());

Parameters

Returns

The blue color value.

Description

Returns the blue color value of a ColorClip object.


setRedPercent(percent:Number) : Void

Usage


my_mc.setRedPercent(50);

Parameters

percent:Number - The red percentage value.

Returns

Nothing.

Description

Specifies a red percentage value for a ColorClip object.


getRedPercent() : Number

Usage


my_mc.setRedPercent(50);
trace (my_mc.getRedPercent());

Parameters

Returns

The red percentage value.

Description

Returns the red percentage value of a ColorClip object.


setGreenPercent(percent:Number) : Void

Usage


my_mc.setGreenPercent(50);

Parameters

percent:Number - The green percentage value.

Returns

Nothing.

Description

Specifies a green percentage value for a ColorClip object.


getGreenPercent() : Number

Usage


my_mc.setGreenPercent(50);
trace (my_mc.getGreenPercent());

Parameters

Returns

The green percentage value.

Description

Returns the green percentage value of a ColorClip object.


setBluePercent(percent:Number) : Void

Usage


my_mc.setBluePercent(50);

Parameters

percent:Number - The blue percentage value.

Returns

Nothing.

Description

Specifies a blue percentage value for a ColorClip object.


getBluePercent() : Number

Usage


my_mc.setBluePercent(50);
trace (my_mc.getBluePercent());

Parameters

Returns

The blue percentage value.

Description

Returns the blue percentage value of a ColorClip object.


setRedOffset(offset:Number) : Void

Usage


my_mc.setRedOffset(-128);

Parameters

percent: - The red offset value.

Returns

Nothing.

Description

Specifies a red offset value for a ColorClip object.


getRedOffset() : Number

Usage


my_mc.setRedOffset(-128);
trace (my_mc.getRedOffset());

Parameters

Returns

The red offset value.

Description

Returns the red offset value of a ColorClip object.


setGreenOffset(offset:Number) : Void

Usage


my_mc.setGreenOffset(-128);

Parameters

percent: - The green offset value.

Returns

Nothing.

Description

Specifies a green offset value for a ColorClip object.


getGreenOffset() : Number

Usage


my_mc.setGreenOffset(-128);
trace (my_mc.getGreenOffset());

Parameters

Returns

The green offset value.

Description

Returns the green offset value of a ColorClip object.


setBlueOffset(offset:Number) : Void

Usage


my_mc.setBlueOffset(-128);

Parameters

percent: - The blue offset value.

Returns

Nothing.

Description

Specifies a blue offset value for a ColorClip object.


getBlueOffset() : Number

Usage


my_mc.setBlueOffset(-128);
trace (my_mc.getBlueOffset());

Parameters

Returns

The blue offset value.

Description

Returns the blue offset value of a ColorClip object.


rgb : Number

Usage


trace (my_mc.rgb);

Description

The rgb property of the ColorClip.


rgbStr : String

Usage


trace (my_mc.rgbStr);

Description

The rgbStr property of the ColorClip.


brightness : Number

Usage


trace (my_mc.brightness);

Description

The brightness property of the ColorClip.


brightOffset : Number

Usage


trace (my_mc.brightOffset);

Description

The brightOffset property of the ColorClip.


negativeColor : Number

Usage


trace (my_mc.negativeColor);

Description

The negativeColor property of the ColorClip.


red : Number

Usage


trace (my_mc.red);

Description

The red property of the ColorClip.


green : Number

Usage


trace (my_mc.green);

Description

The green property of the ColorClip.


blue : Number

Usage


trace (my_mc.blue);

Description

The blue property of the ColorClip.


redPercent : Number

Usage


trace (my_mc.redPercent);

Description

The redPercent property of the ColorClip.


greenPercent : Number

Usage


trace (my_mc.greenPercent);

Description

The greenPercent property of the ColorClip.


bluePercent : Number

Usage


trace (my_mc.bluePercent);

Description

The bluePercent property of the ColorClip.


redOffset : Number

Usage


trace (my_mc.redOffset);

Description

The redOffset property of the ColorClip.


greenOffset : Number

Usage


trace (my_mc.greenOffset);

Description

The greenOffset property of the ColorClip.


blueOffset : Number

Usage


trace (my_mc.blueOffset);

Description

The blueOffset property of the ColorClip.