Packagecom.gestureworks.cml.element
Classpublic class ColorPicker
InheritanceColorPicker Inheritance ElementFactory Inheritance flash.display.Sprite

The ColorPicker element provides color selection capability by moving graphical indicators or adjusting color properties to select hue and color variants. This class supports the drag gesture.
                 
        var cp:ColorPicker = new ColorPicker();
        cp.x = 100;
        cp.y = 100;
        cp.scaleX = cp.scaleX + 1;
        cp.scaleY = cp.scaleY + 1;
        cp.addEventListener(StateEvent.CHANGE, colorSelected);
        addChild(cp);
        

        function colorSelected(event:StateEvent):void
        {
            //trace(event.value);
        }        
     

See also

DatePicker


Public Properties
 PropertyDefined By
 Inheritedalpha : Number
[override] [write-only] sets the alpha for display objects
ElementFactory
 Inheritedblur : Boolean
Sets the drop shadow effect
ElementFactory
 Inheritedbottom : Number
sets the bottom value
ElementFactory
 Inheritedclass_ : String
Object's css class;
ElementFactory
 InheritedclassName : String
sets the class name of displayobject
ElementFactory
 InheritedcmlIndex : int
sets the cml index
ElementFactory
 InheriteddebugStyle : *
sets the debug style
ElementFactory
 InheriteddisplayEvents : String
Use for dispatch completes.
ElementFactory
 InheriteddropShadow : Boolean
Sets the drop shadow effect
ElementFactory
 Inheritedheight : Number
[override] Sets width of the display object in pixels
ElementFactory
 InheritedheightPercent : String
sets the height percent of display object
ElementFactory
 InheritedhorizontalCenter : Number
sets the horizontal center of display object
ElementFactory
 Inheritedid : String
sets the id of child
ElementFactory
 Inheritedindex : int
sets the index of display object
ElementFactory
  labelColor : uint
The color of the labels
ColorPicker
 Inheritedleft : Number
sets left value
ElementFactory
 InheritedpropertyStates : Array
Deprecated: Please Use state
ElementFactory
 Inheritedright : Number
sets the right value
ElementFactory
 Inheritedscale : Number
Sets both the x and y scale values
ElementFactory
 InheritedscaleX : Number
[override] Sets width of the display object in pixels
ElementFactory
 InheritedscaleY : Number
[override] Sets width of the display object in pixels
ElementFactory
  skin : uint
The skin color of the containerRec
ColorPicker
 Inheritedstate : Array
property states array
ElementFactory
 Inheritedtop : Number
sets top value
ElementFactory
 InheritedverticalCenter : Number
sets the vertical center of display object
ElementFactory
 Inheritedwidth : Number
[override] Sets width of the display object in pixels
ElementFactory
 InheritedwidthPercent : String
sets the percent of width of display object
ElementFactory
Public Methods
 MethodDefined By
  
Constructor
ColorPicker
  
Calculates the color's HSB values from its RGB values
ColorPicker
  
Calculates the selectedColor's RGB values
ColorPicker
  
Calculates the color's RGB values from its HSB values
ColorPicker
 Inherited
clone():*
Returns clone of self
ElementFactory
  
[override] CML display initialization callback
ColorPicker
  
dispose():void
[override] Dispose method to nullify the attributes and remove listener
ColorPicker
  
Returns the hex representation of the selectedColor as a String
ColorPicker
  
init():void
[override] Initializes the components
ColorPicker
 Inherited
parseCML(cml:XMLList):XMLList
parses cml file
ElementFactory
 Inherited
postparseCML(cml:XMLList):void
post parses the cml file
ElementFactory
 Inherited
updateProperties(state:Number = 0):void
this method updates the properties
ElementFactory
Protected Methods
 MethodDefined By
  
createTextField(lab:String, _width:Number, _x:Number, _y:Number, _text:String = null, _maxChar:Number = 6):Text
Creates an editable textfield and associated label based on the provided arguments
ColorPicker
  
Retrieve the selected hue from the hueBar and update the base color of the colorRec
ColorPicker
  
updateSelectedColor(color:Number = -1):void
The primary update function called each time a change event occurs.
ColorPicker
Property Detail
labelColorproperty
labelColor:uint

The color of the labels


Implementation
    public function get labelColor():uint
    public function set labelColor(value:uint):void
skinproperty 
skin:uint

The skin color of the containerRec


Implementation
    public function get skin():uint
    public function set skin(value:uint):void
Constructor Detail
ColorPicker()Constructor
public function ColorPicker()

Constructor

Method Detail
calculateHSBFromRGB()method
public function calculateHSBFromRGB():void

Calculates the color's HSB values from its RGB values

calculateRGBFromHex()method 
public function calculateRGBFromHex():void

Calculates the selectedColor's RGB values

calculateRGBFromHSB()method 
public function calculateRGBFromHSB():void

Calculates the color's RGB values from its HSB values

createTextField()method 
protected function createTextField(lab:String, _width:Number, _x:Number, _y:Number, _text:String = null, _maxChar:Number = 6):Text

Creates an editable textfield and associated label based on the provided arguments

Parameters

lab:String — the label name
 
_width:Number — the width of the text field
 
_x:Number — the x location of the text field
 
_y:Number — the y location of the text field
 
_text:String (default = null) — the content of the text field
 
_maxChar:Number (default = 6) — the character limit of the text field

Returns
Text — the resulting text element
displayComplete()method 
override public function displayComplete():void

CML display initialization callback

dispose()method 
override public function dispose():void

Dispose method to nullify the attributes and remove listener

getSelectedHexValue()method 
public function getSelectedHexValue():String

Returns the hex representation of the selectedColor as a String

Returns
String — the hex representation of the selectedColor
init()method 
override public function init():void

Initializes the components

updateBaseGradient()method 
protected function updateBaseGradient():void

Retrieve the selected hue from the hueBar and update the base color of the colorRec

updateSelectedColor()method 
protected function updateSelectedColor(color:Number = -1):void

The primary update function called each time a change event occurs. Assigns the selectedColor value by argument or by retrieving the pixel currently selected in the colorRec, updates the color specs and adjusts the location of the colorSelector accordingly.

Parameters

color:Number (default = -1) — the color to assign as the selectedColor