mx.utils

# ColorUtil - AS3 Flex

Package | mx.utils
Class | public class ColorUtil
Inheritance | ColorUtil Object

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The ColorUtil class is an all-static class with methods for working with RGB colors within Flex. You do not create instances of ColorUtil; instead you simply call static methods such as the `ColorUtil.adjustBrightness()` method.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | adjustBrightness(rgb:uint, brite:Number):uint [static] Performs a linear brightness adjustment of an RGB color. | ColorUtil
|  | adjustBrightness2(rgb:uint, brite:Number):uint [static] Performs a scaled brightness adjustment of an RGB color. | ColorUtil
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | rgbMultiply(rgb1:uint, rgb2:uint):uint [static] Performs an RGB multiplication of two RGB colors. | ColorUtil
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Method Detail

### adjustBrightness

()
method

`public static function adjustBrightness(rgb:uint, brite:Number):uint`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Performs a linear brightness adjustment of an RGB color.

The same amount is added to the red, green, and blue channels of an RGB color. Each color channel is limited to the range 0 through 255.

Parameters

| `rgb:uint` — Original RGB color.
| `brite:Number` — Amount to be added to each color channel. The range for this parameter is -255 to 255; -255 produces black while 255 produces white. If this parameter is 0, the RGB color returned is the same as the original color.

Returns

| `uint` — New RGB color.

### adjustBrightness2

()
method

`public static function adjustBrightness2(rgb:uint, brite:Number):uint`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Performs a scaled brightness adjustment of an RGB color.

Parameters

| `rgb:uint` — Original RGB color.
| `brite:Number` — The percentage to brighten or darken the original color. If positive, the original color is brightened toward white by this percentage. If negative, it is darkened toward black by this percentage. The range for this parameter is -100 to 100; -100 produces black while 100 produces white. If this parameter is 0, the RGB color returned is the same as the original color.

Returns

| `uint` — New RGB color.

### rgbMultiply

()
method

`public static function rgbMultiply(rgb1:uint, rgb2:uint):uint`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Performs an RGB multiplication of two RGB colors.

This always results in a darker number than either original color unless one of them is white, in which case the other color is returned.

Parameters

| `rgb1:uint` — First RGB color.
| `rgb2:uint` — Second RGB color.

Returns

| `uint` — RGB multiplication of the two colors.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00