| Methods | Properties | Effects | Events | Styles | Examples | Frames | No Frames |
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:
Menu.hide() method.
See Also
treeclasses.TreeDataProvider
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. |
static | createMenu(
parent, mdp, initObj)
Returns the Menu instance described by the given MenuDataProvider, and places the instance in the given parent container. |
| getMenuItemAt(
index:
Number)
:
Object Get a reference to an item from this menu. |
| getRootMenu(
)
:
mx.controls.Menu From any menu, walks up the parent menu chain and finds the root menu. |
| hide(
)
:
Void If the Menu is visible, hide it and any visible submenus. |
| indexOf(
item:
Object)
:
Number Returns the index of an item in this menu. |
static | isItemEnabled(
itm:
Object)
:
Boolean If true, item is enabled. |
static | isItemSelected(
itm:
Object)
:
Boolean If true, item is selected. |
| measure(
)
:
Void Measures the menu items to calculate its height and width. |
| 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. |
| setMenuItemEnabled(
item:
Object, enable:
Boolean)
:
Void Marks a menu item as enabled (or not). |
| setMenuItemSelected(
item:
Object, select:
Boolean)
:
Void Marks an item as selected (or not). |
| show(
x:
Number, y:
Number)
:
Void If the Menu isn't visible, place the top left corner at the given coordinates, resize the menu as needed, and make it visible. |
| Methods inherited from class mx.core.ScrollView |
childLoaded
createChildren
createChildWithStyles
getViewMetrics
init
layoutChildren
setScrollProperties
|
| Methods inherited from class mx.core.UIComponent |
drawFocus
getFocus
getFocusManager
setEnabled
setFocus
|
| Properties | |
static | version:
StringVersion string for this class. |
| Properties inherited from class mx.core.ScrollView |
className
hPosition
hScrollPolicy
liveScrolling
maxHPosition
maxVPosition
scrollTipFunction
showScrollTips
version
vPosition
vScrollPolicy
|
| Properties inherited from class mx.core.View |
baselinePosition
className
numChildren
version
|
| Properties inherited from class mx.core.UIComponent |
enabled
errorString
tabEnabled
tabIndex
version
|
| Effects |
| Effects inherited from class mx.core.UIComponent |
focusInEffect
focusOutEffect
|
| Effects inherited from class mx.core.UIObject |
creationCompleteEffect
hideEffect
mouseDownEffect
mouseOutEffect
mouseOverEffect
mouseUpEffect
moveEffect
resizeEffect
showEffect
|
| Events | |
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 Reference to the component that triggered the event. - type The name of the event, change. |
menuHide | Broadcast when a menu or submenu 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 Reference to the component that triggered the event. - type The name of the event, menuHide. |
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. - menu Menu instance, of type Menu.- menuItem Selected menu item. Access the menu item properties as:eventobj.menuItem.attributes.attribName - target Reference to the component that triggered the event. - type The name of the event, menuShow. |
rollOut | Broadcast 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 Reference to the component that triggered the event. - type The name of the event, rollOut. |
rollOver | Broadcast 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 Reference to the component that triggered the event. - type The name of the event, rollOver. |
| Events inherited from class: mx.controls.listclasses.ScrollSelectList |
change itemRollOut itemRollOver |
| Events inherited from class: mx.core.ScrollView |
scroll |
| Events inherited from class: mx.core.View |
childCreated childDestroyed childIndexChanged |
| Events inherited from class: mx.core.UIComponent |
focusIn focusOut invalid keyDown keyUp valid valueCommitted |
| Styles | |
alternatingRowColors |
Type:
Array
CSS Inheritance:
yesColors for rows in an alternating pattern. Value can be an Array of two of more colors. Only used if backgroundColor is not specified |
popupDuration |
Type:
Number
Format:
Time
CSS Inheritance:
noDuration 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:
yesColor of the background when the menu item is rolled over. The default value is 0x0EFFD6. |
selectionColor |
Type:
Number
Format:
Color
CSS Inheritance:
yesColor of the background when the menu item is selected. The default value is 0x0DFFC1. |
selectionDisabledColor |
Type:
Number
Format:
Color
CSS Inheritance:
yesColor The default value is 0xDDDDDD. |
selectionEasing |
Type:
String
CSS Inheritance:
noReference to an easing equation (function) used for controlling programmating tweening. |
textIndent |
Type:
Number
Format:
Length
CSS Inheritance:
yesOffset 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:
yesThe default value is 0x02B333C. |
textSelectedColor |
Type:
Number
Format:
Color
CSS Inheritance:
yesThe default value is 0x005F33. |
| Styles inherited from class mx.core.UIObject |
color
fontFamily
fontSize
fontStyle
fontWeight
horizontalGap
leading
marginLeft
marginRight
textAlign
textDecoration
textIndent
verticalGap
|
| Constructor Detail |
Menu(
)
| Method Detail |
addMenuItem(
arg:
Object)
:
Object
Parameters
arg:
Object - 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(
index:
Number, arg:
Object)
:
Object
Parameters
index:
Number - Index where the item should be inserted. An index of 0 is the first item.
arg:
Object - 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
static
createMenu(
parent, mdp, initObj)
Menu.show() method.
Parameters
parent - A UIObject to use as a starting point for the PopUpManager. The menu may not actually be parented by this UIObject. The PopUpManager will look for a valid top-level Container to use as the parent.
mdp - MenuDataProvider on which to base the menu.
initObj - An object of properties or MXML attributes to be set.
Returns
Menu instance
getMenuItemAt(
index:
Number)
:
Object
Parameters
index:
Number - Index of the item to retrieve.
Returns
Reference to the XMLNode that was removed.
getRootMenu(
)
:
mx.controls.Menu
hide(
)
:
Void
indexOf(
item:
Object)
:
Number
Parameters
item:
Object - Target item.
Returns
Index of the item, or undefined.
static
isItemEnabled(
itm:
Object)
:
Boolean
true, item is enabled. Convenience method for when you have a reference to an item that is deep in the hierrarchy. Otherwise you have to walk the hierarchy to get to the menu first
Parameters
itm:
Object - Item whose state to determine.
static
isItemSelected(
itm:
Object)
:
Boolean
Parameters
itm:
Object - Item whose state to determine.
measure(
)
:
Void
removeAll(
)
:
Object
removeMenuItem(
item:
Object)
:
Object
Parameters
item:
Object - Item to remove.
Returns
Reference to the XMLNode that was removed, or undefined if the item does not belong to this Menu instance.
removeMenuItemAt(
index:
Number)
:
Object
Parameters
index:
Number - Index of the item to remove.
Returns
Reference to the XMLNode that was removed, if any.
setMenuItemEnabled(
item:
Object, enable:
Boolean)
:
Void
Parameters
item:
Object - Target item.
enable:
Boolean - Boolean that indicates whether or not the item is enabled.
setMenuItemSelected(
item:
Object, select:
Boolean)
:
Void
Parameters
item:
Object - Target item.
select:
Boolean - Boolean that indicates whether or not the item is selected
show(
x:
Number, y:
Number)
:
Void
show() method specify the coordinates of the top left corner of the Menu control relative to the parent application of the control, not necessarily to the direct parent of the control. Therefore, if the Menu control is in an HBox container nested within a Panel container, the coordinates are relative to the Application container, not to the HBox container.
Parameters
x:
Number - Horizontal location of the top left corner (optional).
y:
Number - Vertical location of the top left corner (optional).
| Property Detail |
static
version:
String
| Examples |
| SimpleMenuExample.mxml |
|
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/15/asdocs_en/mx/controls/Menu.html
Comments
don4sin said on Feb 15, 2005 at 1:56 PM : No screen name said on Sep 14, 2005 at 9:36 PM : Robin Hilliard said on Jan 12, 2006 at 9:02 PM : fluffysocks said on Mar 24, 2006 at 11:23 AM :