MenuBar.getMenuEnabledAt()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

menuBarInstance.getMenuEnabledAt(index)

Parameters

index The index of the menu in the menu bar.

Returns

A Boolean value that indicates whether this menu can be chosen (true) or not (false).

Description

Method; returns a Boolean value that indicates whether this menu can be chosen (true) or not (false).

Example

The following example creates a File menu with two menu items and then calls setMenuEnabledAt() with a value of false to disable it. It also calls getMenuEnabledAt() and displays the result to show you how to determine whether a menu is enabled.

Drag an instance of the MenuBar component onto the Stage, and enter the instance name my_mb in the Property inspector. Add the following code to Frame 1 of the timeline:

/**
 Requires:
  - MenuBar component on Stage (instance name: my_mb)
*/

var my_mb:mx.controls.MenuBar;

var my_menu:mx.controls.Menu = my_mb.addMenu("File");
my_menu.addMenuItem({label:"New", instanceName:"newInstance"});
my_menu.addMenuItem({label:"Open", instanceName:"openInstance"});

//Disable "file" menu.
my_mb.setMenuEnabledAt(0, false);

//Check if "file" menu can be selected.
trace("Menu can be selected: " + my_mb.getMenuEnabledAt(0));