Menu component

The Menu component lets a user select an item from a pop-up menu, much like the File or Edit menu of most software applications.

NOTE

The Menu component is supported only if you are working in a document that specifies ActionScript 2.0 in its Publish Settings.

A Menu component usually opens in an application when a user rolls over or clicks a button-like menu activator. You can also script a Menu component to open when a user presses a certain key.

Menu components are always created dynamically at runtime. You drag the component from the Components panel to the library, and then use the following code to create a menu with ActionScript:

var myMenu = mx.controls.Menu.createMenu(parent, menuDataProvider);

Use the following code to open a menu in an application:

myMenu.show(x, y);

A menuShow event is broadcast to all of the Menu instance's listeners immediately before the menu is rendered, so you can update the state of the menu items. Similarly, immediately after a Menu instance is hidden, a menuHide event is broadcast.

The items in a menu are described by XML. For more information, see Understanding the Menu component: view and data.

You cannot make the Menu component accessible to screen readers.

Menus are often nested within menu bars. For information about menu bars, see MenuBar component.

Related topics