You first 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 the Menu objects.
var first_menu:Menu = Menu.createMenu();
first_menu.addMenuItem({label:"1st Item"});
var second_menu:Menu = Menu.createMenu();
second_menu.addMenuItem({label:"1st Item 2nd Menu"});
// First usage method
first_menu.addMenuItemAt(1, {label:"Radio Item", instanceName:"radioItem1",
type:"radio", selected:false, enabled:true, groupName:"myRadioGroup"});
// Second usage method
first_menu.addMenuItemAt(2, second_menu.getMenuItemAt(0));
// Show menu.
first_menu.show();
Menu.change
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
Usage 1:
var listenerObject:Object = new Object();
listenerObject.change = function(eventObject:Object) {
// Insert your code here.
};
menuInstance.addEventListener("change", listenerObject);
Usage 2:
on (change) {
// Insert your code here.
}
908
Menu component (Flash Professional only)
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers