User Guide

Menu component (Flash Professional only) 557
When the event is triggered, it automatically passes an event object (eventObject) to the
handler. Each event object has properties that contain information about the event. You can use
these properties to write code that handles the event. The
Menu.change events event object has
the following additional properties:
menuBar A reference to the MenuBar instance that is the parent of the target menu. When
the target menu does not belong to a MenuBar instance, this value is
undefined.
menu A reference to the Menu instance where the target item is located.
menuItem An XML node that is the menu item that was selected.
groupName A string indicating the name of the radio button group to which the item
belongs. If the item is not in a radio button group, this value is
undefined.
For more information, see “EventDispatcher class” on page 415.
Example
In the following example, a handler called listener is defined and passed to
myMenu.addEventListener() as the second parameter. The event object is captured by the
change handler in the evt parameter. When the change event is broadcast, a trace statement is
sent to the Output panel.
listener = new Object();
listener.change = function(evt){
trace("Menu item chosen: "+evt.menuItem.attributes.label);
}
myMenu.addEventListener("change", listener);
Menu.createMenu()
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
Menu.createMenu([parent [, mdp]])
Parameters
parent
A MovieClip instance. The movie clip is the parent component that contains the new
Menu instance. This parameter is optional.
mdp The MenuDataProvider instance that describes this Menu instance. This parameter
is optional.
Returns
A reference to the new menu instance.