MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 971

Components language reference
Table of Contents

Advertisement

Description
Method; enables the menu at the specified index. If there is no menu at that index, calling this
method has no effect.
Example
The following example adds a File menu to the menu bar and calls the
method to enable or disable the menu, depending on whether the menuEnabled_ch check
box is selected or clear.
Drag an instance of the MenuBar component onto the Stage, and enter the instance name
my_mb in the Property inspector. Drag a CheckBox component to the Stage and give it an
instance name of menuEnabled_ch. Add the following code to Frame 1 of the timeline:
/**
Requires:
- MenuBar component on Stage (instance name: my_mb)
- CheckBox component on Stage (instance name: menuEnabled_ch)
*/
import mx.controls.CheckBox;
import mx.controls.Menu;
import mx.controls.MenuBar;
var my_mb:MenuBar;
var menuEnabled_ch:CheckBox;
menuEnabled_ch.selected = true;
var my_menu:Menu = my_mb.addMenu("File");
my_menu.addMenuItem({label:"New", instanceName:"newInstance"});
my_menu.addMenuItem({label:"Open", instanceName:"openInstance"});
var chListener:Object = new Object();
chListener.click = function(evt_obj:Object) {
// Toggle "file" menu.
my_mb.setMenuEnabledAt(0, evt_obj.target.selected);
}
menuEnabled_ch.addEventListener("click", chListener);
setMenuEnabledAt
MenuBar.setMenuEnabledAt()
()
967

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents