Packagecom.gestureworks.cml.elements
Classpublic class Switch
InheritanceSwitch Inheritance TouchContainer Inheritance com.gestureworks.core.TouchSprite

The Switch element is acts as a switch button.
       
        var switch:Switch = new Switch();
        switch.backgroundColor = 0x333333;
        switch.backgroundoutlineColor = 0xFF0000;
        switch.backgroundlineStroke = 3;
        switch.buttonColor = 0x000000;
        switch.buttonoutlineColor = 0x000000;
        switch.buttonlineStroke = 1;
        switch.backgroundWidth = 100;
        switch.backgroundHeight = 50;
        switch.backgroundEllipseWidth = 25;
        switch.backgroundEllipseHeight = 25;
        switch.buttonWidth = 50;
        switch.buttonHeight = 50;
        switch.buttonEllipseWidth = 25;
        switch.buttonEllipseHeight = 25;
        switch.x = 20;
        switch.y = 20;
        addChild(switch);

     

See also

Toggle
Button


Public Properties
 PropertyDefined By
 InheritedautoShuffle : Boolean
autoshuffles
TouchContainer
  background : Sprite
Defines the background which is a rectangle
Switch
  backgroundColor : uint
Sets the background inside color of the Rounded Rectangle
Switch
  backgroundEllipseHeight : Number
Sets the background Ellipse Height of Rounded Rectangle
Switch
  backgroundEllipseWidth : uint
Sets the background Ellipse Width of Rounded Rectangle
Switch
  backgroundHeight : Number
Sets the background Height of Rounded Rectangle
Switch
  backgroundlineStroke : Number
Sets the background linestroke of the Rounded Rectangle
Switch
  backgroundoutlineColor : uint
Sets the background outline color of Rounded Rectangle
Switch
  backgroundWidth : uint
Sets the background Width of Rounded Rectangle
Switch
  backgroundX : uint
Sets the background X position of Rounded Rectangle
Switch
  backgroundY : uint
Sets the background Y position of Rounded Rectangle
Switch
  button : Sprite
Defines the button of background
Switch
  buttonColor : uint
Sets the button inside color of the Rounded Rectangle
Switch
  buttonEllipseHeight : Number
Sets the button Ellipse Height of Rounded Rectangle
Switch
  buttonEllipseWidth : Number
Sets the button Ellipse Width of Rounded Rectangle
Switch
  buttonHeight : Number
Sets the button Height of Rounded Rectangle
Switch
  buttonlineStroke : Number
Sets the button line stroke of the Rounded Rectangle
Switch
  buttonoutlineColor : uint
Sets the button outline color of Rounded Rectangle
Switch
  buttonWidth : Number
Sets the button Width of Rounded Rectangle
Switch
  buttonX : Number
Sets the button X position of Rounded Rectangle
Switch
  buttonY : Number
Sets the button Y position of Rounded Rectangle
Switch
 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
 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
 Inheritedsound : String
TouchContainer
 Inheritedstate : Dictionary
TouchContainer
 InheritedstateId : *
Returns the current state id.
TouchContainer
 InheritedtoBitmap : Boolean
TouchContainer
  toggleState : Boolean = false
Defines the button state
Switch
 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
  
Switch Constructor.
Switch
 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
 Inherited
childToList(id:String, child:*):void
child appended to the childlist
TouchContainer
 Inherited
clone():*
Clone method
TouchContainer
  
creates graphics for background and button
Switch
  
dispose():void
[override] Destructor
Switch
 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
  
init():void
[override] Initializes the configuration and display of the Switch
Switch
 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
Property Detail
backgroundproperty
public var background:Sprite

Defines the background which is a rectangle

backgroundColorproperty 
backgroundColor:uint

Sets the background inside color of the Rounded Rectangle

The default value is 0xFFFFFF.


Implementation
    public function get backgroundColor():uint
    public function set backgroundColor(value:uint):void
backgroundEllipseHeightproperty 
backgroundEllipseHeight:Number

Sets the background Ellipse Height of Rounded Rectangle

The default value is 25.


Implementation
    public function get backgroundEllipseHeight():Number
    public function set backgroundEllipseHeight(value:Number):void
backgroundEllipseWidthproperty 
backgroundEllipseWidth:uint

Sets the background Ellipse Width of Rounded Rectangle

The default value is 25.


Implementation
    public function get backgroundEllipseWidth():uint
    public function set backgroundEllipseWidth(value:uint):void
backgroundHeightproperty 
backgroundHeight:Number

Sets the background Height of Rounded Rectangle

The default value is 50.


Implementation
    public function get backgroundHeight():Number
    public function set backgroundHeight(value:Number):void
backgroundlineStrokeproperty 
backgroundlineStroke:Number

Sets the background linestroke of the Rounded Rectangle

The default value is 3.


Implementation
    public function get backgroundlineStroke():Number
    public function set backgroundlineStroke(value:Number):void
backgroundoutlineColorproperty 
backgroundoutlineColor:uint

Sets the background outline color of Rounded Rectangle

The default value is 0x333333.


Implementation
    public function get backgroundoutlineColor():uint
    public function set backgroundoutlineColor(value:uint):void
backgroundWidthproperty 
backgroundWidth:uint

Sets the background Width of Rounded Rectangle

The default value is 100.


Implementation
    public function get backgroundWidth():uint
    public function set backgroundWidth(value:uint):void
backgroundXproperty 
backgroundX:uint

Sets the background X position of Rounded Rectangle

The default value is 0.


Implementation
    public function get backgroundX():uint
    public function set backgroundX(value:uint):void
backgroundYproperty 
backgroundY:uint

Sets the background Y position of Rounded Rectangle

The default value is 0.


Implementation
    public function get backgroundY():uint
    public function set backgroundY(value:uint):void
buttonproperty 
public var button:Sprite

Defines the button of background

buttonColorproperty 
buttonColor:uint

Sets the button inside color of the Rounded Rectangle

The default value is 0x000000.


Implementation
    public function get buttonColor():uint
    public function set buttonColor(value:uint):void
buttonEllipseHeightproperty 
buttonEllipseHeight:Number

Sets the button Ellipse Height of Rounded Rectangle

The default value is 25.


Implementation
    public function get buttonEllipseHeight():Number
    public function set buttonEllipseHeight(value:Number):void
buttonEllipseWidthproperty 
buttonEllipseWidth:Number

Sets the button Ellipse Width of Rounded Rectangle

The default value is 25.


Implementation
    public function get buttonEllipseWidth():Number
    public function set buttonEllipseWidth(value:Number):void
buttonHeightproperty 
buttonHeight:Number

Sets the button Height of Rounded Rectangle

The default value is 50.


Implementation
    public function get buttonHeight():Number
    public function set buttonHeight(value:Number):void
buttonlineStrokeproperty 
buttonlineStroke:Number

Sets the button line stroke of the Rounded Rectangle

The default value is 1.


Implementation
    public function get buttonlineStroke():Number
    public function set buttonlineStroke(value:Number):void
buttonoutlineColorproperty 
buttonoutlineColor:uint

Sets the button outline color of Rounded Rectangle

The default value is 0x000000.


Implementation
    public function get buttonoutlineColor():uint
    public function set buttonoutlineColor(value:uint):void
buttonWidthproperty 
buttonWidth:Number

Sets the button Width of Rounded Rectangle

The default value is 50.


Implementation
    public function get buttonWidth():Number
    public function set buttonWidth(value:Number):void
buttonXproperty 
buttonX:Number

Sets the button X position of Rounded Rectangle

The default value is 0.


Implementation
    public function get buttonX():Number
    public function set buttonX(value:Number):void
buttonYproperty 
buttonY:Number

Sets the button Y position of Rounded Rectangle

The default value is 0.


Implementation
    public function get buttonY():Number
    public function set buttonY(value:Number):void
toggleStateproperty 
public var toggleState:Boolean = false

Defines the button state

Constructor Detail
Switch()Constructor
public function Switch()

Switch Constructor.

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

creates graphics for background and button

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

Destructor

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

Initializes the configuration and display of the Switch