MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 575

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Using the MenuBar component (Flash Professional only)
You can use the MenuBar component to add a set of menus (for example, File, Edit, Special,
Window) to the top edge of an application.
MenuBar parameters
You can set the following authoring parameter for each MenuBar component instance in the
Property inspector or in the Component inspector:
Labels
An array that adds menu activators with the specified labels to the MenuBar
component. The default value is
You cannot access the Labels parameter using ActionScript. However, you can write ActionScript
to control additional options for the MenuBar component using its properties, methods, and
events. For more information, see
Creating an application with the MenuBar component
In this example, you drag a MenuBar component to the Stage, add code to fill the instance with
menus, and attach listeners to the menus to respond to menu item selection.
To use a MenuBar component in an application:
Select File > New and create a new Flash document.
1.
Drag the MenuBar component from the Components panel to the Stage.
2.
Position the menu at the top of the Stage for a standard layout.
3.
Select the MenuBar instance, and in the Property inspector, enter the instance name
4.
myMenuBar.
In the Actions panel on Frame 1, enter the following code:
5.
var menu = myMenuBar.addMenu("File");
menu.addMenuItem({label:"New", instanceName:"newInstance"});
menu.addMenuItem({label:"Open", instanceName:"openInstance"});
menu.addMenuItem({label:"Close", instanceName:"closeInstance"});
This code adds a File menu to the MenuBar instance. It then uses a Menu method to add three
menu items: New, Open, and Close.
In the Actions panel on Frame 1, enter the following code:
6.
var listen = new Object();
listen.change = function(evt){
var menu = evt.menu;
var item = evt.menuItem
if (item == menu.newInstance){
myNew();
trace(item);
}else if (item == menu.openInstance){
myOpen()
trace(item);
}
}
menu.addEventListener("change",listen);
(an empty array).
[]
"MenuBar class (Flash Professional only)" on page
MenuBar component (Flash Professional only)
578.
575

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents