Packagecom.gestureworks.cml.elements
Classpublic class OrbMenu
InheritanceOrbMenu Inheritance Menu Inheritance TouchContainer Inheritance com.gestureworks.core.TouchSprite

The OrbMenu element creates a free-floating menu that optionally randomly floats around the stage in a screen-saver mode.
     
        var orb:OrbMenu = new OrbMenu();
        
         // listen to orb menu's state event for button presses
        addEventListener(StateEvent.CHANGE, changeBkg);
        
        bkg = new Graphic();
        bkg.shape = "rectangle"; 
        bkg.width = stage.width;
        bkg.height = stage.height;
        bkg.color = 0x000000;
        addChild(bkg);             
         
         //can set the timer and attract mode of orbmenu
         orb.repeatTimer = 1;
         orb.attractMode = true;
         
         //curve text location of orbmenu
         orb.textX = 90;
         orb.textY = 80;
         orb.textRadius = 100;
         orb.curveText = "MENU";
         orb.coverage = 0.4;
         orb.startAngle = 100;
         orb.stopAngle = 100;
         
         //circle radius
         orb.orbRadius = 100;
         
         //gradient matrix graphics
         orb.gradientType = "linear";
         orb.gradientColors = "0x404040, 0x404040";
         orb.gradientAlphas = "1,1";
         orb.gradientRatios = "0,255";
         orb.gradientHeight = 100;
         orb.gradientWidth = 50;
         orb.gradientRotation = 0;
         orb.gradientX = 25;
         orb.gradientY = 0;
         
         //outer circle graphics
         orb.shape1LineStoke = 3;
         orb.shape1OutlineColor = 0x000000;
         
         //inner circle graphics
         orb.shape2LineStoke = 3;
         orb.shape2OutlineColor = 0x000000;
         
         //background(rectangle) graphics
         orb.backgroundColor = 0x808080;
         orb.backgroundOutlineColor = 0x000000;
         orb.backgroundLineStoke = 3;
    
         //background(rectangle) graphics                
         background = new Graphic();
         background.visible = false;
         orb.addChild(background);
    
    
         var numberOfButtons:int = 3;
         var width:Number = 100;
         var height:Number = 135;
         var orbRadius:Number = 100;
                    
         buttons = new Array(numberOfButtons);
        
        // position of buttons,lines,background
         
          {
            var line:Sprite = new Sprite();
            line.graphics.lineStyle(0, 0x000000, 1);
            line.graphics.moveTo((width i + orbRadius), 0);
            line.graphics.lineTo((width i + orbRadius), height);
            
            buttons[i] = new Button();
                            
            if (i==0)
                buttons[i] = createButton(buttons[i], "btn0", "grey");
            else if (i == 1)
                buttons[i] = createButton(buttons[i], "btn1","purple");
            else if (i == 2)
                buttons[i] = createButton(buttons[i], "btn2", "pink");
            
            buttons[i].x = 100 + width i;
            buttons[i].y = 0;
            
            background.addChild(buttons[i]);
            buttons[i].init();
                                        
            background.addChild(line);
          }
          
        if (numberOfButtons > 1)
        {
            background.graphics.beginFill(0x808080);
            background.graphics.drawRoundRect(0- width , 0, (orbRadius + width) + (width numberOfButtons), 135, 25, 25);
        }
        else
        {
            background.graphics.drawRoundRect(0, 0, (orbRadius + width), 135, 25, 25);
        }
        
         orb.buttons = buttons;
         orb.init();
         addChild(orb);        

         
        function createButton(b:Button, type:String, value:String):Button
        {
            var btnUp:Container = new Container();
            btnUp.id = type + "-up";
                        
            var text:Text = new Text();
            text.text = value;
            text.x = 17;
            text.y = 45;
            text.selectable = false;
            text.color = 0x151B54;
            text.fontSize = 20;
            text.visible = true;
            text.multiline = true;
            text.font = "OpenSansRegular";
            btnUp.addChild(text);
                        
            var btnDown:Container = new Container();
            btnDown.id = "btn-down";
                    
            var btnHit:Container = new Container();
            btnHit.id = type + "-hit";
            
            var hitBg:Graphic = new Graphic();
            hitBg.shape = "rectangle";
            hitBg.id = type + "HitBg";
            hitBg.alpha = 0;
            hitBg.width = 100;
            hitBg.height = 100;
            hitBg.lineStroke = 1.5;
            hitBg.color = 0xCCCCCC;
            
            btnHit.addChild(hitBg);
            btnHit.childToList(type + "HitBg", hitBg);
            
            b.addChild(btnUp);
            b.childToList(type + "-up", btnUp);
            
            b.addChild(btnDown);
            b.childToList(type + "-down", btnDown);
            
            b.addChild(btnHit);
            b.childToList(type + "-hit", btnHit);
            
            b.initial = type + "-up";
                        
            b.up = type + "-up";
            b.out = type + "-up";
            b.down = type + "-down";
            b.hit = type + "-hit";
            
            b.dispatch = "down:" + type;
                        
            return b;
        }
        
        
        //background color changes on state event.
        function changeBkg(event:StateEvent):void
        {
            if (event.value == "btn0")
            {
                bkg.visible = true;
                bkg.color = 0x817679;
            }
            else if (event.value == "btn1")
            {
                bkg.visible = true;    
                bkg.color = 0x5E5A80;
            }
            else if (event.value == "btn2")
            {
                bkg.visible = true;
                bkg.color = 0xC48189;
            }
        }
    
     
     



Public Properties
 PropertyDefined By
  attractMode : Boolean
defines whether Orbmenu is floating or not
OrbMenu
 Inheritedautohide : Boolean
Menu
 InheritedautoHide : Boolean
Specifies whether the menu automatically hides when not in use
Menu
 InheritedautoHideTime : Number
Specifies the auto-hide time
Menu
 InheritedautoShuffle : Boolean
autoshuffles
TouchContainer
  background : Sprite
Defines background in rectangle shape of orbMenu.
OrbMenu
  backgroundColor : uint
Sets the background color
OrbMenu
  backgroundLineStoke : uint
Sets the background line stoke
OrbMenu
  backgroundOutlineColor : uint
Sets the background out line color
OrbMenu
 InheritedbuttonArray : Array
Menu
  buttons : Array
Defines array of buttons.
OrbMenu
 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
  coverage : Number
defines the coverage of text
OrbMenu
  curveText : String
defines the text
OrbMenu
 InheriteddimensionsTo : Object
Sets the dimensions of TouchContainer to given object
TouchContainer
  dropshadow : DropShadowFilter
Defines dropshadow filter for shape.
OrbMenu
 InheriteddropShadow : Boolean
Sets the drop shadow effect
TouchContainer
  filtersArray : Array
Defines array for drop shadow filter.
OrbMenu
  gradientAlphas : String
Sets the alpha transparency of gradient for shapes
OrbMenu
  gradientColors : String
Sets the array of color values of gradient for shapes
OrbMenu
  gradientHeight : Number
the width (in pixels) to which the gradient will spread
OrbMenu
  gradientRatios : String
Sets the ratios of gradient for shapes
OrbMenu
  gradientRotation : Number
the rotation (in radians) that will be applied to the gradient
OrbMenu
  gradientType : String
Sets the gardient type for shapes
OrbMenu
  gradientWidth : Number
the width (in pixels) to which the gradient will spread
OrbMenu
  gradientX : Number
how far (in pixels) the gradient is shifted horizontally
OrbMenu
  gradientY : Number
how far (in pixels) the gradient is shifted horizontally
OrbMenu
 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
  line : Sprite
Defines intersection lines of background.
OrbMenu
  matrix : Matrix
Defines to control gradient appearance of shapes.
OrbMenu
 InheritedmouseChildren : Boolean
[override] sets the mousechildren value to true or false.
TouchContainer
  orbRadius : Number
Defines radius of orbmenu.
OrbMenu
 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 : *
[override] Specifies the position alogorithm of the menu.
Menu
 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
  repeatTimer : Number
number of times the timer will tick before the timer stops itself
OrbMenu
  shape1 : Sprite
Defines the OuterCircle which is a rectangle
OrbMenu
  shape1LineStoke : Number
Defines linestoke of shape1.
OrbMenu
  shape1OutlineColor : uint
Sets the outline color of shape1
OrbMenu
  shape2 : Sprite
Defines the InnerCircle which is a rectangle
OrbMenu
  shape2LineStoke : Number
Defines linestoke of shape2.
OrbMenu
  shape2OutlineColor : uint
Sets the outline color of shape2
OrbMenu
 Inheritedslider : Slider
Menu
 Inheritedsound : String
TouchContainer
  startAngle : Number
defines start angle for text
OrbMenu
 Inheritedstate : Dictionary
TouchContainer
 InheritedstateId : *
Returns the current state id.
TouchContainer
  stopAngle : Number
defines stop angle for text
OrbMenu
  textRadius : Number
defines radius of text
OrbMenu
  textX : Number
defines the centerX position of text
OrbMenu
  textY : Number
Defines centerY position of text
OrbMenu
 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.
OrbMenu
 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():*
[override] Returns clone of self
Menu
  
dispose():void
[override] Dispose method
OrbMenu
 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] CML display initialization callback defines positions for buttons,lines and rectangle.
OrbMenu
 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
reset():void
Menu
 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
startTimer():void
if autohide on, adds the listener
Menu
 Inherited
tweenState(sId:* = null, tweenTime:Number = 1):void
Tween state by stateIndex from current to given state index.
TouchContainer
 Inherited
updateLayout(containerWidth:Number, containerHeight:Number):void
sets the layout depending on the position
Menu
 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
attractModeproperty
attractMode:Boolean

defines whether Orbmenu is floating or not


Implementation
    public function get attractMode():Boolean
    public function set attractMode(value:Boolean):void
backgroundproperty 
public var background:Sprite

Defines background in rectangle shape of orbMenu.

backgroundColorproperty 
backgroundColor:uint

Sets the background color

The default value is = 0x666666;.


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

Sets the background line stoke

The default value is = 3;.


Implementation
    public function get backgroundLineStoke():uint
    public function set backgroundLineStoke(value:uint):void
backgroundOutlineColorproperty 
backgroundOutlineColor:uint

Sets the background out line color

The default value is = 0x000000;.


Implementation
    public function get backgroundOutlineColor():uint
    public function set backgroundOutlineColor(value:uint):void
buttonsproperty 
public var buttons:Array

Defines array of buttons.

coverageproperty 
coverage:Number

defines the coverage of text


Implementation
    public function get coverage():Number
    public function set coverage(value:Number):void
curveTextproperty 
curveText:String

defines the text


Implementation
    public function get curveText():String
    public function set curveText(value:String):void
dropshadowproperty 
public var dropshadow:DropShadowFilter

Defines dropshadow filter for shape.

filtersArrayproperty 
public var filtersArray:Array

Defines array for drop shadow filter.

gradientAlphasproperty 
gradientAlphas:String

Sets the alpha transparency of gradient for shapes

The default value is = [1, 1];.


Implementation
    public function get gradientAlphas():String
    public function set gradientAlphas(value:String):void
gradientColorsproperty 
gradientColors:String

Sets the array of color values of gradient for shapes

The default value is = [0x404040 , 0x404040];.


Implementation
    public function get gradientColors():String
    public function set gradientColors(value:String):void
gradientHeightproperty 
gradientHeight:Number

the width (in pixels) to which the gradient will spread

The default value is = 100;.


Implementation
    public function get gradientHeight():Number
    public function set gradientHeight(value:Number):void
gradientRatiosproperty 
gradientRatios:String

Sets the ratios of gradient for shapes

The default value is = [0, 255];.


Implementation
    public function get gradientRatios():String
    public function set gradientRatios(value:String):void
gradientRotationproperty 
gradientRotation:Number

the rotation (in radians) that will be applied to the gradient

The default value is = 0;.


Implementation
    public function get gradientRotation():Number
    public function set gradientRotation(value:Number):void
gradientTypeproperty 
gradientType:String

Sets the gardient type for shapes

The default value is = GradientType.LINEAR;.


Implementation
    public function get gradientType():String
    public function set gradientType(value:String):void
gradientWidthproperty 
gradientWidth:Number

the width (in pixels) to which the gradient will spread

The default value is = 50;.


Implementation
    public function get gradientWidth():Number
    public function set gradientWidth(value:Number):void
gradientXproperty 
gradientX:Number

how far (in pixels) the gradient is shifted horizontally

The default value is = 25;.


Implementation
    public function get gradientX():Number
    public function set gradientX(value:Number):void
gradientYproperty 
gradientY:Number

how far (in pixels) the gradient is shifted horizontally

The default value is = 0;.


Implementation
    public function get gradientY():Number
    public function set gradientY(value:Number):void
lineproperty 
public var line:Sprite

Defines intersection lines of background.

matrixproperty 
public var matrix:Matrix

Defines to control gradient appearance of shapes.

orbRadiusproperty 
orbRadius:Number

Defines radius of orbmenu.

The default value is = 100;.


Implementation
    public function get orbRadius():Number
    public function set orbRadius(value:Number):void
repeatTimerproperty 
repeatTimer:Number

number of times the timer will tick before the timer stops itself

The default value is = 1;.


Implementation
    public function get repeatTimer():Number
    public function set repeatTimer(value:Number):void
shape1property 
public var shape1:Sprite

Defines the OuterCircle which is a rectangle

shape1LineStokeproperty 
shape1LineStoke:Number

Defines linestoke of shape1.

The default value is = 5;.


Implementation
    public function get shape1LineStoke():Number
    public function set shape1LineStoke(value:Number):void
shape1OutlineColorproperty 
shape1OutlineColor:uint

Sets the outline color of shape1

The default value is = 0x000000;.


Implementation
    public function get shape1OutlineColor():uint
    public function set shape1OutlineColor(value:uint):void
shape2property 
public var shape2:Sprite

Defines the InnerCircle which is a rectangle

shape2LineStokeproperty 
shape2LineStoke:Number

Defines linestoke of shape2.

The default value is = 4;.


Implementation
    public function get shape2LineStoke():Number
    public function set shape2LineStoke(value:Number):void
shape2OutlineColorproperty 
shape2OutlineColor:uint

Sets the outline color of shape2

The default value is = 0x000000;.


Implementation
    public function get shape2OutlineColor():uint
    public function set shape2OutlineColor(value:uint):void
startAngleproperty 
startAngle:Number

defines start angle for text


Implementation
    public function get startAngle():Number
    public function set startAngle(value:Number):void
stopAngleproperty 
stopAngle:Number

defines stop angle for text


Implementation
    public function get stopAngle():Number
    public function set stopAngle(value:Number):void
textRadiusproperty 
textRadius:Number

defines radius of text


Implementation
    public function get textRadius():Number
    public function set textRadius(value:Number):void
textXproperty 
textX:Number

defines the centerX position of text


Implementation
    public function get textX():Number
    public function set textX(value:Number):void
textYproperty 
textY:Number

Defines centerY position of text


Implementation
    public function get textY():Number
    public function set textY(value:Number):void
Constructor Detail
OrbMenu()Constructor
public function OrbMenu()

Constructor.

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

Dispose method

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

CML display initialization callback defines positions for buttons,lines and rectangle.