Packagecom.happytoad.libs.riatrax
Classpublic class Menu
InheritanceMenu Inheritance mx.controls.Menu

The Menu component includes automatic Google Analytic tracking.

Copyright (c) 2009 HappyToad IT Consulting (http://www.happytoad.com)
Created by Rich Tretola (http://blog.everythingflex.com)

View the examples.

See also

com.happytoad.libs.riatrax.Tracker


Public Properties
 PropertyDefined by
  gaAction : String
String to be passed to Google as the Action property.
Menu
  gaCategory : String
String to be passed to Google as the Category property.
Menu
  gaLabel : String
String to be passed to Google as the Label property.
Menu
  gaMode : String
String to set tracking mode for compoment.
Menu
  gaValue : Number
Number to be passed to Google as the Value property.
Menu
Public Methods
 MethodDefined by
  
Menu()
Constructor.
Menu
  
createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean = true):Menu
[static] Creates and returns an instance of the Menu class.
Menu
Property detail
gaActionproperty
gaAction:String  [read-write]

String to be passed to Google as the Action property.
An optional action for the event (e.g. "Play").

Implementation
    public function get gaAction():String
    public function set gaAction(value:String):void
gaCategoryproperty 
gaCategory:String  [read-write]

String to be passed to Google as the Category property.
An optional category for the event (e.g. "Videos").

Implementation
    public function get gaCategory():String
    public function set gaCategory(value:String):void
gaLabelproperty 
gaLabel:String  [read-write]

String to be passed to Google as the Label property.
An optional descriptor for the event.

Implementation
    public function get gaLabel():String
    public function set gaLabel(value:String):void
gaModeproperty 
gaMode:String  [read-write]

String to set tracking mode for compoment. ( unique | all | none )
This property defaults to unique. Set to all to track all events or none to disable tracking

Implementation
    public function get gaMode():String
    public function set gaMode(value:String):void
gaValueproperty 
gaValue:Number  [read-write]

Number to be passed to Google as the Value property.
An optional value to be aggregated with the event.

Implementation
    public function get gaValue():Number
    public function set gaValue(value:Number):void
Constructor detail
Menu()constructor
public function Menu()

Constructor.

Method detail
createMenu()method
public static function createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean = true):Menu

Creates and returns an instance of the Menu class. The Menu control's content is determined by the method's mdp argument. The Menu control is placed in the parent container specified by the method's parent argument. This method does not show the Menu control. Instead, this method just creates the Menu control and allows for modifications to be made to the Menu instance before the Menu is shown. To show the Menu, call the Menu.show() method.

Parameters
parent:DisplayObjectContainer — A container that the PopUpManager uses to place the Menu control in. The Menu control may not actually be parented by this object.
 
mdp:Object — The data provider for the Menu control.
 
showRoot:Boolean (default = true) — A Boolean flag that specifies whether to display the root node of the data provider.

Returns
Menu — An instance of the Menu class.

See also

mx.controls.Menu
mx.controls.Menu
mx.controls.Menu.popUpMenu()
Examples
MenuExample
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:rx="com.happytoad.libs.riatrax.*"
    creationComplete="init()">
    
    <mx:Script>
        <![CDATA[
            import com.happytoad.libs.riatrax.Tracker;
            import com.happytoad.libs.riatrax.Menu;       
            import flash.geom.Point;
            private var tracker:Tracker = Tracker.getInstance();
            private function init():void{
                tracker.account="UA-xxxxxx-y";
                tracker.display=this;
                tracker.visualDebug = true;
            }
            private var point1:Point = new Point();
            private var menu:Menu;
               private var dataset:Array = [{"data":"onedata","label":"onelabel"},
                                         {"data":"twodata","label":"twolabel"}];
            private function showMenu():void {
                menu= Menu.createMenu(panel, dataset, false);
                menu.labelField="label"
                menu.gaMode = "none";
                point1.x=panel.x;
                point1.y=panel.y;                
                point1=panel.localToGlobal(point1);
                menu.show(point1.x + 25, point1.y + 25);
            }
        ]]>
    </mx:Script>
    
    <mx:Panel id="panel" title="Menu Control Example" height="80%" width="80%" 
         layout="absolute" horizontalCenter="0" verticalCenter="0">
        <mx:Button label="Open Menu" click="showMenu();" 
            horizontalCenter="0" verticalCenter="0"/>
    </mx:Panel>
    
</mx:Application>