mx.controls
Class Menu



class Menu
extends mx.controls.listclasses.ScrollSelectList

The Menu control creates a pop-up menu of individually selectable choices, similar to the File or Edit menu found in most software applications. After a Menu opens, it remains visible until it is closed by any of the following:

The Menu class has no corresponding MXML tag.

See Also
mx.controls.menuclasses.MenuRow
mx.controls.treeclasses.TreeDataProvider
mx.controls.treeclasses.XMLTreeDataProvider
mx.managers.PopUpManager
mx.effects.Tween



Constructors
Menu ()
Constructor


Methods
      addMenuItem(arg:Object) : Object
Appends a menu item to the end of this menu.
      addMenuItemAt(index:Number, arg:Object) : Object
Inserts an item into this menu at a specified location.
      createChildren() : Void
Child construction.
staticcreateMenu(parent, mdp, initObj) : Void
Returns the Menu instance described by the given MenuDataProvider, and places the instance in the given parent container.
      getMenuItemAt(index:Number) : Object
Retrieves an item from this menu.
      getRootMenu() : Menu
Climbs up and finds the root menu.
      hide() : Void
If the Menu is visible, hide both it and any visible submenus.
      indexOf(item:Object) : Number
Returns the index of an item in this menu.
staticisItemEnabled(itm:Object) : Boolean
If true, item is enabled.
staticisItemSelected(itm:Object) : Boolean
If true, item is selected.
      removeAll() : Object
Removes all items from the menu.
      removeMenuItem(item:Object) : Object
Removes an item from the menu.
      removeMenuItemAt(index:Number) : Object
Removes the item at a given location from the menu.
      setMenuDelay(delay:Number, request:String, args:Object) : Void
Interval functions that delay submenu tasks.
      setMenuItemEnabled(item:Object, enable:Boolean) : Void
Marks a menu item as enabled (or not), and notifies listeners.
      setMenuItemSelected(item:Object, select:Boolean) : Void
Marks anitem as selected (or not), and notifies listeners.
      show(x:Number, y:Number) : Void
If the Menu isn`t visible, place the top left corner at the given coordinates within the parent, resize the menu as needed, and make it visible.

Methods inherited from class mx.controls.listclasses.ScrollSelectList
calculateWidths  setPropertiesAt 

Methods inherited from class mx.core.ScrollView
setScrollProperties  getViewMetrics  createChild 

Methods inherited from class mx.core.View
init  draw  createChild  getChildAt  getChildIndex  setChildIndex  destroyAllChildren  destroyChild  destroyChildAt  getViewMetrics 

Methods inherited from class mx.core.UIComponent
getFocus  setFocus  getFocusManager 

Methods inherited from class mx.core.UIObject
createAccessibilityImplementation  measure  doLater  cancelAllDoLaters  invalidate  invalidateStyle  invalidateProperties  invalidateSize  redraw  move  setSize  setSizeNoLayout  drawRect  fillRect  destroyLabel  createClassObject  createEmptyObject  destroyObject  getStyle  setMask  swapDepths 


Properties
staticversion:String  
ComponentVersion is for internal use only.

Properties inherited from class mx.controls.listclasses.ScrollSelectList
dragEnabled  dataProvider  addItemAt  addItem  removeItemAt  removeAll  replaceItemAt  sortItemsBy  sortItems  getLength  getItemAt  value  selectedIndex  selectedIndices  selectedItems  selectedItem  selectable  multipleSelection  dropIndicatorSkin  rowHeight  rowCount  cellRenderer  labelField  labelFunction  iconField  iconFunction 

Properties inherited from class mx.core.ScrollView
version  className  hScrollPolicy  vScrollPolicy  hPosition  vPosition  maxVPosition  maxHPosition 

Properties inherited from class mx.core.View
version  className  numChildren 

Properties inherited from class mx.core.UIComponent
version  enabled  tabIndex 

Properties inherited from class mx.core.UIObject
version  nestLevel  dispatchEvent  addEventListener  handleEvent  removeEventListener  kStretch  styleName  className  setStyle  parentApplication  isDocument  parentDocument  documentDescriptor  descriptor  instanceIndices  repeaterIndices  getRepeaterItem  id  width  height  x  y  minHeight  minWidth  preferredHeight  preferredWidth  maxHeight  maxWidth  widthFlex  heightFlex  visible  scaleX  scaleY  alpha  depth  mouseX  mouseY  toolTip  baselinePosition 


Effects

Effects inherited from class mx.core.UIComponent
showEffect  hideEffect  focusInEffect  focusOutEffect 

Effects inherited from class mx.core.UIObject
creationCompleteEffect  moveEffect  resizeEffect  mouseDownEffect  mouseOverEffect  mouseOutEffect  mouseUpEffect 


Events
changeBroadcast when a user selects an item in the Menu control. The event object contains the properties: - menuBar MenuBar instance that is the parent of the selected Menu control, or undefined when the target Menu control does not belong to a MenuBar control.
- menu Menu instance that was hidden, of type Menu.
- menuItem Selected menu item. Access the menu item properties as:
eventobj.menuItem.attributes.attribName 

- groupName Name of the radio-group to which the item belongs. Undefined when the target item is not in a radio group. The data type is String.
Target contains a reference to the component that triggered the event. Type contains the name of the event.
menuShowBroadcast when the entire menu or a submenu opens. The event object contains the properties: - menuBar MenuBar instance that is the parent of the selected Menu control, or undefined when the target Menu control does not belong to a MenuBar control.
- menu Menu instance, of type Menu.
- menuItem Selected menu item. Access the menu item properties as:
eventobj.menuItem.attributes.attribName 

Target contains a reference to the component that triggered the event. Type contains the name of the event.
menuHideBroadcast when a menu closes. The event object contains the properties: - menuBar MenuBar instance that is the parent of the selected Menu control, or undefined when the target Menu control does not belong to a MenuBar control.
- menuItem Selected menu item. Access the menu item properties as:
eventobj.menuItem.attributes.attribName 

Target contains a reference to the component that triggered the event. Type contains the name of the event.
rollOutBroadcast when the cursor rolls off of a Menu item. The event object contains the properties: - menuItem Selected menu item. Access the menu item properties as:
eventobj.menuItem.attributes.attribName 

- menu Menu instance, of type Menu.
- menuBar MenuBar instance that is the parent of the selected Menu control, or undefined when the target Menu control does not belong to a MenuBar control.
Target contains a reference to the component that triggered the event. Type contains the name of the event.
rollOverBroadcast when the cursor rolls over a Menu item. The event object contains the properties: - menuItem Selected menu item. Access the menu item properties as:
eventobj.menuItem.attributes.attribName

- menu Menu instance, of type Menu.
- menuBar MenuBar instance that is the parent of the selected Menu control, or undefined when the target Menu control does not belong to a MenuBar control.
Target contains a reference to the component that triggered the event. Type contains the name of the event.
menuHideBroadcast when the entire menu or a submenu closes. Target contains a reference to the component that triggered the event. Type contains the name of the event.
menuShowBroadcast when the entire menu or a submenu opens. Target contains a reference to the component that triggered the event. Type contains the name of the event.

Events inherited from class: mx.controls.listclasses.ScrollSelectList
change  itemRollOver  itemRollOut 

Events inherited from class: mx.core.ScrollView
scroll 

Events inherited from class: mx.core.View
childCreated  childIndexChanged  childDestroyed 

Events inherited from class: mx.core.UIComponent
focusIn  focusOut  keyDown  keyUp  show  hide  valid  invalid  valueCommitted 

Events inherited from class: mx.core.UIObject
initialize  creationComplete  resize  move  draw  load  unload  mouseDown  mouseUp  mouseMove  mouseOver  mouseOut  mouseDownSomewhere  mouseUpSomewhere  mouseMoveSomewhere  mouseChangeSomewhere  effectStart  effectEnd  dragBegin  dragComplete  dragEnter  dragOver  dragExit  dragDrop 


Styles
alternatingRowColors Type: Array   CSS Inheritance: yes
Colors for rows in an alternating pattern. Value can be an array of two of more colors.
popupDuration Type: Number   Format: Time   CSS Inheritance: no
Duration in milliseconds of the transition as the menu opens. The value 0 specifies no transiton. The default value is 150.
rollOverColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the background when the link is rolled over. The default value is #0E#FFD6.
selectionColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the background when the link is selected. The default value is #0DFFC1.
selectionDisabledColor Type: Number   Format: Color   CSS Inheritance: yes
Color The default value is 0DDDDDD.
selectionEasing Type: String   CSS Inheritance: no
Reference to an easing equatjion (function) used for controlling programmating tweening.
textDisabledColor Type: Number   Format: Color   CSS Inheritance: yes
The default value is #0FFFFF.
textIndent Type: Number   Format: Length   CSS Inheritance: no
Offset of the first line of text from the left side of the container. The default vlue is 0.
textRollOverColor Type: Number   Format: Color   CSS Inheritance: yes
The default value is #02B333C.
textSelectedColor Type: Number   Format: Color   CSS Inheritance: yes
The default value is #005F33.

Styles inherited from class mx.core.UIComponent
backgroundColor  backgroundDisabledColor  backgroundImage  backgroundAlpha  backgroundSize  barColor  borderCapColor  borderColor  buttonColor  borderStyle  disabledColor  errorColor  highlightColor  lineHeight  modalTransparency  scrollTrackColor  shadowColor  shadowCapColor  symbolColor  symbolBackgroundColor  symbolBackgroundDisabledColor  symbolBackgroundPressedColor  symbolDisabledColor  themeColor 

Styles inherited from class mx.core.UIObject
color  fontFamily  fontSize  fontStyle  fontWeight  textAlign  textDecoration  textIndent  marginLeft  marginRight  horizontalGap  verticalGap 


Constructor Detail

Menu

Menu()

Constructor


Method Detail

addMenuItem

addMenuItem(arg:Object) : Object

Appends a menu item to the end of this menu.

Parameters
     arg - May be one of the following: a String, to be used as the item`s label; an Object, whose properties are copied into the resulting XMLNode`s attributes; an XMLNode, used directly; or an XML instance whose firstChild will be cloned and used.

Returns
     XMLNode that carries a representation of the menu item's state.


addMenuItemAt

addMenuItemAt(index:Number, arg:Object) : Object

Inserts an item into this menu at a specified location.

Parameters
     index - Index where the item should be inserted.
     arg - May be one of the following: a String, to be used as the item`s label; an Object, whose properties are copied into the resulting XMLNode`s attributes; an XMLNode, used directly; or an XML instance whose firstChild is cloned and used.

Returns
     XMLNode carrying a representation of the menu item's state


createChildren

createChildren() : Void

Child construction.


createMenu

static createMenu(parent, mdp, initObj) :  Void

Returns the Menu instance described by the given MenuDataProvider, and places the instance in the given parent container.

Parameters
     parent - Container.
     mdp - MenuDataProvider on which to base the menu.
     initObj -

Returns
     Menu instance, already placed inside the parent, but invisible.


getMenuItemAt

getMenuItemAt(index:Number) : Object

Retrieves an item from this menu.

Parameters
     index - Index of the item to retrieve.

Returns
     Reference to the XMLNode that was removed.


getRootMenu

getRootMenu() : Menu

Climbs up and finds the root menu.


hide

hide() : Void

If the Menu is visible, hide both it and any visible submenus.


indexOf

indexOf(item:Object) : Number

Returns the index of an item in this menu. If the item does not belong to this menu, it returns undefined.

Parameters
     item - Target item.

Returns
     Index of the item, or undefined.


isItemEnabled

static isItemEnabled(itm:Object) : Boolean

If true, item is enabled.

Parameters
     itm - Item whose state to determine.


isItemSelected

static isItemSelected(itm:Object) : Boolean

If true, item is selected.

Parameters
     itm - Item whose state to determine.


removeAll

removeAll() : Object

Removes all items from the menu.


removeMenuItem

removeMenuItem(item:Object) : Object

Removes an item from the menu. If the item doesn`t belong to this Menu, do nothing and return undefined.

Parameters
     item - Item to remove.

Returns
     Reference to the XMLNode that was removed, or undefined if the item does not belong to this Menu instance.


removeMenuItemAt

removeMenuItemAt(index:Number) : Object

Removes the item at a given location from the menu. If there`s no item at the given location, do nothing and return undefined.

Parameters
     index - Index of the item to remove.

Returns
     Reference to the XMLNode that was removed, if any.


setMenuDelay

setMenuDelay(delay:Number, request:String, args:Object) : Void

Interval functions that delay submenu tasks.

Parameters
     delay -
     request -
     args -


setMenuItemEnabled

setMenuItemEnabled(item:Object, enable:Boolean) : Void

Marks a menu item as enabled (or not), and notifies listeners.

Parameters
     item - Target item.
     enable - Boolean that indicates whether or not the item is enabled.


setMenuItemSelected

setMenuItemSelected(item:Object, select:Boolean) : Void

Marks anitem as selected (or not), and notifies listeners.

Parameters
     item - Target item.
     select - Boolean that indicates whether or not the item is selected


show

show(x:Number, y:Number) : Void

If the Menu isn`t visible, place the top left corner at the given coordinates within the parent, resize the menu as needed, and make it visible. This method also fires a show event to all listeners.

Parameters
     x - Horizontal location of the top left corner (optional).
     y - Vertical location of the top left corner (optional).


Property Detail

version

static version:String  

ComponentVersion is for internal use only.