User Guide

Menu.setMenuItemEnabled() 929
Menu.setMenuItemEnabled()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
menuInstance.setMenuItemEnabled(item, enable)
Parameters
item An XML node; the target menu items node in the data provider.
enable A Boolean value indicating whether the item is enabled (true) or not (false).
Returns
Nothing.
Description
Method; changes the target items enabled attribute to the state specified in the enable
parameter. If this call results in a change of state, the item is redrawn with the new state.
Example
The following example creates a menu with two menu items and calls the
setMenuItemEnabled() method to disable the first one.
First, you drag a Menu component to the library and then add the following code to Frame 1:
/**
Requires:
- Menu component in library
*/
import mx.controls.Menu;
// Create an XML object to act as a factory.
var my_xml:XML = new XML();
// The item created next does not appear in the menu.
// The createMenu() method call (below) expects to
// receive a root element whose children will become
// the items. This is just a simple way to create that
// root element and give it a convenient name.
var menuDP_obj:Object = my_xml.addMenuItem("XXXXX");