MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 547

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

Advertisement

To use the MenuDataProvider class to create and populate a menu:
Select File > New and create a Flash document.
1.
Drag the Menu component from the Components panel to the Stage and delete it.
2.
This adds the Menu component to the library without adding it to the application. Menus are
created dynamically through ActionScript.
In the Actions panel, add the following code to the first frame to create a menu and add
3.
some items:
// Create an XML object to act as a factory.
var xml = new XML();
// The item created next will 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 along
// the way.
var theMenuElement = xml.addMenuItem("Edit");
// Add the menu items.
theMenuElement.addMenuItem({label:"Undo"});
theMenuElement.addMenuItem({type:"separator"});
theMenuElement.addMenuItem({label:"Cut"});
theMenuElement.addMenuItem({label:"Copy"});
theMenuElement.addMenuItem({label:"Paste"});
theMenuElement.addMenuItem({label:"Clear", enabled:"false"});
theMenuElement.addMenuItem({type:"separator"});
theMenuElement.addMenuItem({label:"Select All"});
// Create the Menu object.
var theMenuControl = mx.controls.Menu.createMenu(_root, theMenuElement);
Select Control > Test Movie.
4.
Customizing the Menu component (Flash Professional only)
The menu sizes itself horizontally to fit its widest text. You can also call the
size the component. Icons should be sized to a maximum of 16 by 16 pixels.
Menu component (Flash Professional only)
method to
setSize()
547

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?

This manual is also suitable for:

Flash mx

Table of Contents