MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 558

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

Advertisement

Description
Method (static); instantiates a Menu instance, and optionally attaches it to the specified parent,
with the specified MenuDataProvider as the data source for the menu items.
If the
parameter is omitted or null, the Menu is attached to the
parent
If the
parameter is omitted or null, the menu does not have any items; you must call
mdp
or
addMenu()
setDataProvider()
Example
In the following example, line 1 creates a MenuDataProvider instance, which is an XML object
that has the methods of the MenuDataProvider class.
In the following example, the first line creates an XML object instance, which is given the
methods of the MenuDataProvider class (because the
of the XMLNode class). The next line adds a menu item (New) with a submenu (File, Project,
and Resource). The next block of code adds more items to the main menu. The third block of
code creates an empty menu attached to
opens it at the coordinates (100,20):
var myMDP:XML = new XML();
var newItem:Object = myMDP.addMenuItem({label:"New"});
newItem.addMenuItem({label:"File..."});
newItem.addMenuItem({label:"Project..."});
newItem.addMenuItem({label:"Resource..."});
myMDP.addMenuItem({label:"Open", instanceName:"miOpen"});
myMDP.addMenuItem({label:"Save", instanceName:"miSave"});
myMDP.addMenuItem({type:"separator"});
myMDP.addMenuItem({label:"Quit", instanceName:"miQuit"});
var myMenu:mx.controls.Menu = mx.controls.Menu.createMenu(myParentClip,
myMDP);
myMenu.show(100, 20);
To test this code, place it in the Actions panel on Frame 1 of the main Timeline. Drag a Menu
component from the Components panel to the Stage and delete it. (This adds it to the library
without placing it in the document.)
Menu.dataProvider
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
myMenu.dataProvider
558
Chapter 6: Components Dictionary
to populate the menu.
MenuDataProvider class
, fills it with the data source
myParentClip
Timeline.
_root
is a decorator class
, and
myMDP

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents