Packagecom.gestureworks.cml.element
Classpublic class Toggle
InheritanceToggle Inheritance ElementFactory Inheritance flash.display.Sprite

The Toggle element acts as a toggle button. It adds a crossline graphic inside of square when toggled.
     
       var toggle:Toggle = new Toggle();
       toggle.fillColor = 0x333333;
       toggle.backgroundLineColor = 0xFF0000;
       toggle.toggleLineStoke = 4;
       toggle.x = 100;
       toggle.y = 100;
       addChild(toggle);
    
       toggle.addEventListener(StateEvent.CHANGE, onToggle);
    
       var txt:TextElement = new TextElement;
       txt.text = "hello";
       txt.x = 200;
       txt.y = 130;
       txt.visible = false;
       addChild(txt);
    
       function onToggle(event:StateEvent):void
       {
          //trace("toggle text", event.value);

          if (event.value == "true")
              txt.visible = true;
          else
              txt.visible = false;
       }
     
     



Public Properties
 PropertyDefined By
 Inheritedalpha : Number
[override] [write-only] sets the alpha for display objects
ElementFactory
  background : Sprite
Defines the square background
Toggle
  backgroundColor : uint
Sets the inside color of the background
Toggle
  backgroundLineColor : uint
Sets the color of the background line color
Toggle
  backgroundLineStoke : Number
Sets the background Line Stoke
Toggle
 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
 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
  toggleColor : uint
Sets the toggle color of the background
Toggle
  toggleGraphic : Sprite
The "x" graphic in the background
Toggle
  toggleLineStoke : Number
Sets the toggle Line Stoke of the background
Toggle
 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
Toggle
 Inherited
clone():*
Returns clone of self
ElementFactory
  
[override] CML display initialization callback
Toggle
  
dispose():void
[override] Dispose method
Toggle
  
draw():void
Draws the background and x graphic in background
Toggle
  
init():void
[override] Initializes the configuration and display of the toggle
Toggle
 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 square background

backgroundColorproperty 
backgroundColor:uint

Sets the inside color of the background

The default value is 0x333333.


Implementation
    public function get backgroundColor():uint
    public function set backgroundColor(value:uint):void
backgroundLineColorproperty 
backgroundLineColor:uint

Sets the color of the background line color

The default value is 0x00ff00.


Implementation
    public function get backgroundLineColor():uint
    public function set backgroundLineColor(value:uint):void
backgroundLineStokeproperty 
backgroundLineStoke:Number

Sets the background Line Stoke

The default value is 1.


Implementation
    public function get backgroundLineStoke():Number
    public function set backgroundLineStoke(value:Number):void
toggleColorproperty 
toggleColor:uint

Sets the toggle color of the background

The default value is 0x00FF00.


Implementation
    public function get toggleColor():uint
    public function set toggleColor(value:uint):void
toggleGraphicproperty 
public var toggleGraphic:Sprite

The "x" graphic in the background

toggleLineStokeproperty 
toggleLineStoke:Number

Sets the toggle Line Stoke of the background

The default value is 1.


Implementation
    public function get toggleLineStoke():Number
    public function set toggleLineStoke(value:Number):void
Constructor Detail
Toggle()Constructor
public function Toggle()

Constructor

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

CML display initialization callback

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

Dispose method

draw()method 
public function draw():void

Draws the background and x graphic in background

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

Initializes the configuration and display of the toggle