Packagecom.gestureworks.cml.element
Classpublic class OrbMenu
InheritanceOrbMenu Inheritance Menu Inheritance Container Inheritance ContainerFactory Inheritance ElementFactory Inheritance flash.display.Sprite

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
 Inheritedalpha : Number
[override] [write-only] sets the alpha for display objects
ElementFactory
  attractMode : Boolean
defines whether Orbmenu is floating or not
OrbMenu
 InheritedautoHide : Boolean
Specifies whether the menu automatically hides when not in use
Menu
 InheritedautoHideTime : Number
Specifies the auto-hide time
Menu
  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
 Inheritedblur : Boolean
Sets the drop shadow effect
ElementFactory
 Inheritedbottom : Number
sets the bottom value
ElementFactory
 InheritedbuttonArray : Array
Menu
  buttons : Array
Defines array of buttons.
OrbMenu
 InheritedchildList : ChildList
[read-only] store the child list
ContainerFactory
 Inheritedclass_ : String
Object's css class;
ElementFactory
 InheritedclassName : String
sets the class name of displayobject
ElementFactory
 InheritedcmlIndex : int
sets the cml index
ElementFactory
  coverage : Number
defines the coverage of text
OrbMenu
  curveText : String
defines the text
OrbMenu
 InheriteddebugStyle : *
sets the debug style
ElementFactory
 InheriteddimensionsTo : String
sets the dimensions of the container
ContainerFactory
 InheriteddisplayEvents : String
Use for dispatch completes.
ElementFactory
  dropshadow : DropShadowFilter
Defines dropshadow filter for shape.
OrbMenu
 InheriteddropShadow : Boolean
Sets the drop shadow effect
ElementFactory
  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
 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
 InheritedinfoSource : String
sets info source
ContainerFactory
 Inheritedlayout : *
Sets the layout of the container
Container
 InheritedlayoutComplete : Function
Sets the function to call when the layout is complete
Container
 InheritedlayoutList : Dictionary
Defines the layoutlist
Container
 InheritedlayoutUpdate : Function
Sets the function to call when the layout updates
Container
 Inheritedleft : Number
sets left value
ElementFactory
  line : Sprite
Defines intersection lines of background.
OrbMenu
  matrix : Matrix
Defines to control gradient appearance of shapes.
OrbMenu
  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.
Container
 InheritedpaddingLeft : Number
Sets the number of pixels between the component's left border and the left edge of its content area.
Container
 InheritedpaddingRight : Number
Sets the number of pixels between the component's right border and the right edge of its content area.
Container
 InheritedpaddingTop : Number
Sets the number of pixels between the container's top border and the top of its content area.
Container
 Inheritedposition : String
[override] Specifies the position alogorithm of the menu.
Menu
 InheritedpropertyStates : Array
Deprecated: Please Use state
ElementFactory
  repeatTimer : Number
number of times the timer will tick before the timer stops itself
OrbMenu
 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
  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
  startAngle : Number
defines start angle for text
OrbMenu
 Inheritedstate : Array
property states array
ElementFactory
  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
 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.
OrbMenu
 Inherited
This method searches the childlist and add the children
ContainerFactory
 Inherited
addChild(child:DisplayObject):DisplayObject
[override] Adds child to display list and, if not already added, the child list TODO: This mechanism should be abstracted to better syncrhonize child and display lists
Container
 Inherited
applyLayout(value:* = null):void
Apply the containers layout
Container
 Inherited
childToList(id:String, child:*):void
this method append to the childlist
ContainerFactory
 Inherited
clone():*
[override] Returns clone of self
Menu
  
[override] CML display initialization callback defines positions for buttons,lines and rectangle.
OrbMenu
  
dispose():void
[override] Dispose methods to nullify attributes and remove listeners
OrbMenu
 Inherited
getIndex(index:int):*
returns childlist index
Container
 Inherited
getKey(key:String):*
returns the childlist key
Container
 Inherited
hideIndex(index:int):void
hides the childlist index
Container
 Inherited
hideKey(key:String):void
hides the childlist key
Container
  
init():void
[override] Initializes the configuration and display of orbMenu
OrbMenu
 Inherited
parseCML(cml:XMLList):XMLList
[override] Parse cml for local layouts.
Container
 Inherited
postparseCML(cml:XMLList):void
post parses the cml file
ElementFactory
 Inherited
reset():void
Menu
 Inherited
searchChildren(value:*, returnType:Class = null):*
This method does a depth first search of childLists.
Container
 Inherited
This method sets the dimensions of childlist
ContainerFactory
 Inherited
showIndex(index:int):void
shows the childlist index
Container
 Inherited
showKey(key:String):void
shows the childlist key
Container
 Inherited
startTimer():void
if autohide on, adds the listener
Menu
 Inherited
updateLayout(containerWidth:Number, containerHeight:Number):void
sets the layout depending on the position
Menu
 Inherited
updateProperties(state:Number = 0):void
this method updates the properties
ElementFactory
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
displayComplete()method
override public function displayComplete():void

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

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

Dispose methods to nullify attributes and remove listeners

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

Initializes the configuration and display of orbMenu