Color | +--com.robertpenner.graphics.XColor
The XColor class extends the Color class adding a collection of utilities that allows for more intuitive color manipulation.
ActionScript 2.0; Flash Player 6
Property summary
Property | Description |
---|---|
rgb:Number |
The rgb property of the XColor object. |
rgbStr:String |
The rgbStr property of the XColor object. |
brightness:Number |
The brightness property of the XColor object. |
brightOffset:Number |
The brightOffset property of the XColor object. |
negative:Number |
The negative property of the XColor object. |
red:Number |
The red property of the XColor object. |
green:Number |
The green property of the XColor object. |
blue:Number |
The blue property of the XColor object. |
redPercent:Number |
The redPercent property of the XColor object. |
greenPercent:Number |
The greenPercent property of the XColor object. |
bluePercent:Number |
The bluePercent property of the XColor object. |
redOffset:Number |
The redOffset property of the XColor object. |
greenOffset:Number |
The greenOffset property of the XColor object. |
blueOffset:Number |
The blueOffset property of the XColor object. |
Method summary
Method | Description |
---|---|
setRGB(col:Number) : Void |
Specifies an RGB color for an XColor object. |
getRGB() : Number |
Returns the R+G+B combination currently in use by the XColor object. |
setRGBStr(hexStr:String) : Void |
Specifies an RGB color for an XColor object using a string hexadecimal value. |
getRGBStr() : String |
Returns the R+G+B combination currently in use by the XColor object as a string hexadecimal value. |
setRGB2(r:Number, g:Number, b:Number) : Void |
Specifies an RGB color for an XColor object using individual red, green, and blue values. |
getRGB2() : Object |
Returns the R+G+B values currently in use by the XColor object as individual red, green, and blue values. |
setTransform(trans:Object) : Void |
Sets color transform information for an XColor object. |
getTransform() : Object |
Returns the transform value set by the last XColor.setTransform() call. |
reset() : Void |
Sets the color transform for an XColor object to its default values. |
setBrightness(bright:Number) : Void |
Specifies the brightness of an XColor object. |
getBrightness() : Number |
Returns the brightness of an XColor object. |
setBrightOffset(offset:Number) : Void |
Pushes an XColor object towards black or white by an absolute amount. |
getBrightOffset() : Number |
Returns the brightness offset value of an XColor object. |
setTint(r:Number, g:Number, b:Number, percent:Number) : Void |
Tints an XColor object with a color according to a certain percentage. |
getTint() : Object |
Returns the tint of an XColor object. |
setTint2(rgb:Number, percent:Number) : Void |
Tints an XColor object with a color according to a certain percentage. |
getTint2() : Object |
Returns the tint of an XColor object. |
setTintOffset(r:Number, g:Number, b:Number) : Void |
Tints an XColor object with a color according to red, green, and blue values. |
getTintOffset() : Object |
Returns the tint offset of an XColor object. |
setTintOffset2(rgb:Number) : Void |
Tints an XColor object with a color according to an rgb value. |
getTintOffset2() : Number |
Returns the tint offset of an XColor object. |
invert() : Void |
Performs a straightforward color inversion. |
setNegative(percent:Number) : Void |
Inverts an XColor object by a certain percentage. |
getNegative() : Number |
Returns the negative percentage of an XColor object. |
setRed(amount:Number) : Void |
Specifies a red color value for an XColor object. |
getRed() : Number |
Returns the red color value of an XColor object. |
setGreen(amount:Number) : Void |
Specifies a green color value for an XColor object. |
getGreen() : Number |
Returns the green color value of an XColor object. |
setBlue(amount:Number) : Void |
Specifies a blue color value for an XColor object. |
getBlue() : Number |
Returns the blue color value of an XColor object. |
setRedPercent(percent:Number) : Void |
Specifies a red percentage value for an XColor object. |
getRedPercent() : Number |
Returns the red percentage value of an XColor object. |
setGreenPercent(percent:Number) : Void |
Specifies a green percentage value for an XColor object. |
getGreenPercent() : Number |
Returns the green percentage value of an XColor object. |
setBluePercent(percent:Number) : Void |
Specifies a blue percentage value for an XColor object. |
getBluePercent() : Number |
Returns the blue percentage value of an XColor object. |
setRedOffset(offset:Number) : Void |
Specifies a red offset value for an XColor object. |
getRedOffset() : Number |
Returns the red offset value of an XColor object. |
setGreenOffset(offset:Number) : Void |
Specifies a green offset value for an XColor object. |
getGreenOffset() : Number |
Returns the green offset value of an XColor object. |
setBlueOffset(offset:Number) : Void |
Specifies a blue offset value for an XColor object. |
getBlueOffset() : Number |
Returns the blue offset value of an XColor object. |
var my_color:XColor = new XColor(my_mc);
my_color.setRGB(0xFFFF00);
col:Number
- The hexadecimal or RGB color to be set.
Nothing.
Specifies an RGB color for an XColor object.
var my_color:XColor = new XColor(my_mc);
trace (my_color.getRGB());
A number that represents the RGB numeric value for the color specified.
Returns the R+G+B combination currently in use by the XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRGBStr("#FFFF00");
hexStr:String
- The string hexadecimal color to be set.
Nothing.
Specifies an RGB color for an XColor object using a string hexadecimal value.
var my_color:XColor = new XColor(my_mc);
trace (my_color.getRGBStr());
The string hexadecimal color.
Returns the R+G+B combination currently in use by the XColor object as a string hexadecimal value.
var my_color:XColor = new XColor(my_mc);
my_color.setRGB2(255, 0, 255);
r:Number
- The red color value.
g:Number
- The green color value.
b:Number
- The blue color value.
Nothing.
Specifies an RGB color for an XColor object using individual red, green, and blue values.
var my_color:XColor = new XColor(my_mc);
my_color.setRGB2(255, 0, 255);
var rgb:Object = my_color.getRGB2();
trace (rgb.r);
trace (rgb.g);
trace (rgb.b);
The RBG value object with r, g, and b properties.
Returns the R+G+B values currently in use by the XColor object as individual red, green, and blue values.
var my_color:XColor = new XColor(my_mc);
var my_trans:Object = {ra:50, rb:244, ga:40, gb:112, ba:12, bb:90, aa:40, ab:70};
my_color.setTransform(my_trans);
trans:Object
- An object that must have the following properties that specify color transform values: ra, rb, ga, gb, ba, bb, aa, ab.
Nothing.
Sets color transform information for an XColor object.
var my_color:XColor = new XColor(my_mc);
var trans:Object = my_color.getTransform();
trace ([trans.ra, trans.rb, trans.ga, trans.gb, trans.ba, trans.bb, trans.aa, trans.ab]);
An object whose properties contain the current offset and percentage values for the specified color.
Returns the transform value set by the last XColor.setTransform() call.
var my_color:XColor = new XColor(my_mc);
my_color.setRGB(0x0000FF);
my_color.reset();
Nothing.
Sets the color transform for an XColor object to its default values.
var my_color:XColor = new XColor(my_mc);
my_color.setBrightness(50);
bright:Number
- A percentage value between -100 and 100. Positive values brighten the color. and negative values darken it.
Nothing.
Specifies the brightness of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBrightness(50);
trace (my_color.getBrightness());
The brightness value.
Returns the brightness of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBrightOffset(140);
offset:Number
- A number between -255 and 255. Positive values push colors towards white; negative values towards black.
Nothing.
Pushes an XColor object towards black or white by an absolute amount.
var my_color:XColor = new XColor(my_mc);
my_color.setBrightOffset(140);
trace (my_color.getBrightOffset());
The brightness offset value.
Returns the brightness offset value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setTint(0, 0, 128, 50);
r:Number
- The red color value.
g:Number
- The green color value.
b:Number
- The blue color value.
percent:Number
- The tint percentage.
Nothing.
Tints an XColor object with a color according to a certain percentage.
var my_color:XColor = new XColor(my_mc);
my_color.setTint(0, 0, 128, 50);
var tint:Object = my_color.getTint();
trace (tint.r);
trace (tint.g);
trace (tint.b);
trace (tint.percent);
The tint value object with r, g, b, and percent properties.
Returns the tint of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setTint2(0x0000FF, 100);
rgb:Number
- The rgb value.
percent:Number
- The tint percentage.
Nothing.
Tints an XColor object with a color according to a certain percentage.
var my_color:XColor = new XColor(my_mc);
my_color.setTint2(0x0000FF, 100);
var tint:Object = my_color.getTint2();
trace (tint.rgb);
trace (tint.percent);
The tint value object with rgb and percent properties.
Returns the tint of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setTintOffset(0, 0, 128);
r:Number
- The red color value.
g:Number
- The green color value.
b:Number
- The blue color value.
Nothing.
Tints an XColor object with a color according to red, green, and blue values.
var my_color:XColor = new XColor(my_mc);
my_color.setTintOffset(0, 0, 128);
var tint:Object = my_color.getTintOffset();
trace (tint.r);
trace (tint.g);
trace (tint.b);
The tint offset value object with r, g, and b properties.
Returns the tint offset of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setTintOffset2(0x000080);
rgb:Number
- The rgb value.
Nothing.
Tints an XColor object with a color according to an rgb value.
var my_color:XColor = new XColor(my_mc);
my_color.setTintOffset2(0x000080);
trace (my_color.getTintOffset2());
The tint offset value object with an rgb properties.
Returns the tint offset of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.invert();
Nothing.
Performs a straightforward color inversion.
var my_color:XColor = new XColor(my_mc);
my_color.setNegative(60);
percent:Number
- The negative percentage.
Nothing.
Inverts an XColor object by a certain percentage.
var my_color:XColor = new XColor(my_mc);
my_color.setNegative(60);
trace (my_color.getNegative());
The negative percentage.
Returns the negative percentage of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRed(128);
amount:Number
- The red color value.
Nothing.
Specifies a red color value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRed(128);
trace (my_color.getRed());
The red color value.
Returns the red color value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setGreen(128);
amount:Number
- The green color value.
Nothing.
Specifies a green color value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setGreen(128);
trace (my_color.getGreen());
The green color value.
Returns the green color value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBlue(128);
amount:Number
- The blue color value.
Nothing.
Specifies a blue color value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBlue(128);
trace (my_color.getBlue());
The blue color value.
Returns the blue color value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRedPercent(50);
percent:Number
- The red percentage value.
Nothing.
Specifies a red percentage value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRedPercent(50);
trace (my_color.getRedPercent());
The red percentage value.
Returns the red percentage value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setGreenPercent(50);
percent:Number
- The green percentage value.
Nothing.
Specifies a green percentage value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setGreenPercent(50);
trace (my_color.getGreenPercent());
The green percentage value.
Returns the green percentage value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBluePercent(50);
percent:Number
- The blue percentage value.
Nothing.
Specifies a blue percentage value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBluePercent(50);
trace (my_color.getBluePercent());
The blue percentage value.
Returns the blue percentage value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRedOffset(-128);
percent:
- The red offset value.
Nothing.
Specifies a red offset value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setRedOffset(-128);
trace (my_color.getRedOffset());
The red offset value.
Returns the red offset value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setGreenOffset(-128);
percent:
- The green offset value.
Nothing.
Specifies a green offset value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setGreenOffset(-128);
trace (my_color.getGreenOffset());
The green offset value.
Returns the green offset value of an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBlueOffset(-128);
percent:
- The blue offset value.
Nothing.
Specifies a blue offset value for an XColor object.
var my_color:XColor = new XColor(my_mc);
my_color.setBlueOffset(-128);
trace (my_color.getBlueOffset());
The blue offset value.
Returns the blue offset value of an XColor object.
trace (my_color.rgb);
The rgb property of the XColor object.
trace (my_color.rgbStr);
The rgbStr property of the XColor object.
trace (my_color.brightness);
The brightness property of the XColor object.
trace (my_color.brightOffset);
The brightOffset property of the XColor object.
trace (my_color.negative);
The negative property of the XColor object.
trace (my_color.red);
The red property of the XColor object.
trace (my_color.green);
The green property of the XColor object.
trace (my_color.blue);
The blue property of the XColor object.
trace (my_color.redPercent);
The redPercent property of the XColor object.
trace (my_color.greenPercent);
The greenPercent property of the XColor object.
trace (my_color.bluePercent);
The bluePercent property of the XColor object.
trace (my_color.redOffset);
The redOffset property of the XColor object.
trace (my_color.greenOffset);
The greenOffset property of the XColor object.
trace (my_color.blueOffset);
The blueOffset property of the XColor object.