Packagecom.gestureworks.cml.elements
Classpublic class ColorPicker
InheritanceColorPicker Inheritance TouchContainer Inheritance com.gestureworks.core.TouchSprite

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
 InheritedautoShuffle : Boolean
autoshuffles
TouchContainer
 InheritedchildList : ChildList
Returns the object's childList.
TouchContainer
 InheritedclassName : String
sets the class name of displayobject
TouchContainer
 InheritedcloneExclusions : Vector.<String>
[read-only] Returns a list of properties to exclude when cloning this object
TouchContainer
 InheritedcmlIndex : int
Returns the index created by the CML parser.
TouchContainer
 InheriteddimensionsTo : Object
Sets the dimensions of TouchContainer to given object
TouchContainer
 InheriteddropShadow : Boolean
Sets the drop shadow effect
TouchContainer
 Inheritedgroup : String
TouchContainer
 Inheritedheight : Number
[override] sets the height of the container
TouchContainer
 InheritedheightPercent : Number
sets the height of the container
TouchContainer
 Inheritedid : String
Returns the object's id.
TouchContainer
  labelColor : uint
The color of the labels
ColorPicker
 Inheritedlayout : *
specifies the type of layout
TouchContainer
 InheritedlayoutList : Dictionary
TouchContainer
 InheritedmouseChildren : Boolean
[override] sets the mousechildren value to true or false.
TouchContainer
 InheritedpaddingBottom : Number
Sets the number of pixels between the container's bottom border and the bottom of its content area.
TouchContainer
 InheritedpaddingLeft : Number
Sets the number of pixels between the component's left border and the left edge of its content area.
TouchContainer
 InheritedpaddingRight : Number
Sets the number of pixels between the component's right border and the right edge of its content area.
TouchContainer
 InheritedpaddingTop : Number
Sets the number of pixels between the container's top border and the top of its content area.
TouchContainer
 Inheritedposition : *
Sets the position
TouchContainer
 InheritedrelativeX : Boolean
When set true this containers children's x position will be laid out relatively to each other.
TouchContainer
 InheritedrelativeY : Boolean
When set true this containers children's y position will be laid out relatively to each other.
TouchContainer
  skin : uint
The skin color of the containerRec
ColorPicker
 Inheritedsound : String
TouchContainer
 Inheritedstate : Dictionary
TouchContainer
 InheritedstateId : *
Returns the current state id.
TouchContainer
 InheritedtoBitmap : Boolean
TouchContainer
 Inheritedwidth : Number
[override] sets the width of the container
TouchContainer
 InheritedwidthPercent : Number
sets the width of the container
TouchContainer
Protected Properties
 PropertyDefined By
 InheritedcmlGestureList : Object
TouchContainer
Public Methods
 MethodDefined By
  
Constructor
ColorPicker
 Inherited
TouchContainer
 Inherited
method searches the child and adds to the list
TouchContainer
 Inherited
addChild(child:DisplayObject):DisplayObject
[override] Adds child to display list and, if not already added, the child list
TouchContainer
 Inherited
addChildAt(child:DisplayObject, index:int):DisplayObject
[override] Adds child to display list and, if not already added, the child list
TouchContainer
 Inherited
applyLayout(value:* = null):void
Apply the containers layout
TouchContainer
  
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
childToList(id:String, child:*):void
child appended to the childlist
TouchContainer
 Inherited
clone():*
Clone method
TouchContainer
  
dispose():void
[override] Destructor
ColorPicker
 Inherited
getElementById(id:String):*
Searches CML childList by id.
TouchContainer
 Inherited
getElementsByClassName(className:String):Array
Searches the CML childList by className.
TouchContainer
 Inherited
getElementsByTagName(tagName:Class):Array
Searches the CML childList by tagName as Class.
TouchContainer
  
Returns the hex representation of the selectedColor as a String
ColorPicker
  
init():void
[override] Initializes the components
ColorPicker
 Inherited
loadState(sId:* = null, recursion:Boolean = false):void
Loads state by index number.
TouchContainer
 Inherited
makeGestureList(value:XMLList):Object
Creates gestureList object from XML
TouchContainer
 Inherited
parseCML(cml:XMLList):XMLList
Parse cml for local layouts.
TouchContainer
 Inherited
postparseCML(cml:XMLList):void
Abstract method allows the setting of a postparse CML routine.
TouchContainer
 Inherited
querySelector(selector:String):*
Searches the CML childList by selector.
TouchContainer
 Inherited
querySelectorAll(selector:*):Array
Search the CML childList by selector.
TouchContainer
 Inherited
removeChild(child:DisplayObject):DisplayObject
[override] Removes child from display list and, if not already removed, the child list
TouchContainer
 Inherited
removeChildAt(index:int):DisplayObject
[override] Removes child from display list and, if not already removed, the child list
TouchContainer
 Inherited
removeChildren(beginIndex:int = 0, endIndex:int = 2147483647):void
[override] Removes children from display list and, if not already removed, the child list
TouchContainer
 Inherited
saveState(sId:* = null, recursion:Boolean = false):void
Save state by index number.
TouchContainer
 Inherited
searchChildren(value:*, returnType:Class = null):*
This method does a depth first search of childLists.
TouchContainer
 Inherited
method sets the dimensions of each child
TouchContainer
 Inherited
tweenState(sId:* = null, tweenTime:Number = 1):void
Tween state by stateIndex from current to given state index.
TouchContainer
 Inherited
Updates child padding within this container
TouchContainer
 Inherited
Updates child percent dimensions within this container
TouchContainer
 Inherited
updateProperties(state:* = 0):void
Updates properties from state.
TouchContainer
 Inherited
Updates child relative positions within this container
TouchContainer
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
dispose()method 
override public function dispose():void

Destructor

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