Packagecom.gestureworks.cml.element
Classpublic class Switch
InheritanceSwitch Inheritance ElementFactory Inheritance flash.display.Sprite

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
 Inheritedalpha : Number
[override] [write-only] sets the alpha for display objects
ElementFactory
  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
 Inheritedblur : Boolean
Sets the drop shadow effect
ElementFactory
 Inheritedbottom : Number
sets the bottom value
ElementFactory
  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
 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
 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
 Inheritedstate : Array
property states array
ElementFactory
  toggleState : Boolean = false
Defines the button state
Switch
 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
  
Switch Constructor.
Switch
 Inherited
clone():*
Returns clone of self
ElementFactory
  
creates graphics for background and button
Switch
  
[override] CML display initialization callback
Switch
  
dispose():void
[override] Dispose method
Switch
  
init():void
[override] Initializes the configuration and display of the Switch
Switch
 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
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

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

CML display initialization callback

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

Dispose method

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

Initializes the configuration and display of the Switch