The MenuBar control defines a horizontal menu bar that contains one or more submenus. The MenuBar control is static: it does not pop up, but rather is always visible in your application.
MXML Syntax
The <mx:MenuBar> tag inherits all the properties of its parent classes, and the following properties:
<mx:MenuBar
dataProvider="No default."
labelField="No default."
menuHide="Event handler. No default."
change="Event handler. No default."
menushow="Event handler. No default."
rollOut="Event handler. No default."
rollOver="Event handler. No default."
/>
| Methods | |
| addMenu(arg1, arg2) : Menu
Adds a single menu to the end of MenuBar control and returns the index of the new menu in the MenuBar control. |
| addMenuAt(index, arg1, arg2) : Void
Adds a menu to the MenuBar control at the specified location. |
| getMenuAt(index) : Menu
Returns a reference to the menu item as the specified index. |
| getMenuEnabledAt(index) : Void
Returns true if the menu item at the specified index is enabled. |
| init() : Void
Generic initializer. |
| labelFunction
Function that determines what displays as the text for each menu item. |
| removeMenuAt(index) : Menu
Removes the specified menu from the MenuBar control. |
| setDataProvider(dp) : Void
Loads the state from the given XMLNode object. |
| setMenuEnabledAt(index, enable) : Void
Enables the menu item at the specified index. |
| Methods inherited from class mx.core.UIComponent |
getFocus
setFocus
getFocusManager
|
| Properties | |
static | version:String
ComponentVersion is for internal use only. |
| labelField:String
[Read-Write]
Name of the field in the dataProvider Array to use as the text for each menu item. |
| dataProvider:Object
[Read-Write]
Array of simple types or Objects. |
| Properties inherited from class mx.core.UIComponent |
version
enabled
tabIndex
|
| 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 | |
menuShow | Broadcast 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. Target contains a reference to the component that triggered the event. Type contains the name of the event. |
menuHide | Broadcast 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. - menu Menu instance that was hidden, of type Menu. Target contains a reference to the component that triggered the event. Type contains the name of the event. |
rollOver | Broadcast when the cursor rolls over a Menu item. The event object contains the properties: - menuItem The 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. |
rollOut | Broadcast when the cursor rolls off of a Menu item. The event object contains the properties: - menuItem The selected menu item. Access the menu item properties as: eventobj.menuItem.attributes.attribNameTarget contains a reference to the component that triggered the event. Type contains the name of the event. |
change | Broadcast 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. |
| Events inherited from class: mx.core.UIComponent |
focusIn
focusOut
keyDown
keyUp
show
hide
valid
invalid
valueCommitted
|
| Styles | |
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. |
| Styles inherited from class mx.core.UIObject |
color
fontFamily
fontSize
fontStyle
fontWeight
textAlign
textDecoration
textIndent
marginLeft
marginRight
horizontalGap
verticalGap
|
| Method Detail |
addMenu(arg1, arg2) : Menu
Parameters
arg1 - May be either: a String, which is the item`s label; or an xmlNode.
arg2 - May be: undefined; a menu; or an xml/xmlNode.
Returns
Reference to the new Menu.
addMenuAt(index, arg1, arg2) : Void
Parameters
index - Index where the menu should be inserted.
arg1 - May be either:a String, which is the item`s label; or an xmlNode.
arg2 - May be: undefined; a menu; or an xml/xmlNode.
Returns
The reference to the new Menu.
getMenuAt(index) : Menu
Parameters
index - Index of the menu instance to return.
Returns
Reference to the menu at the specified index.
getMenuEnabledAt(index) :
Void
Parameters
index - Index of the menu instance.
Returns
Boolean of the enabled state of the specified menu.
init() : Void
labelFunction() :
Void
removeMenuAt(index) : Menu
Parameters
index - Index of the menu instance to remove.
Returns
Reference to the menu that was removed.
setDataProvider(dp) :
Void
Parameters
dp - DataProvider.
setMenuEnabledAt(index, enable) :
Void
Parameters
index - Index of the menu instance to enable.
enable - Whether to enable the menu on the MenuBar.
| Property Detail |
dataProvider:Object
[Read-Write]
labelField:String
[Read-Write]
static version:String