Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > Menu component > Menu.show() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
menuInstance.show(x,y)
x The x coordinate.
y The y coordinate.
Nothing.
Method; opens a menu at a specific location. The menu is automatically resized so that all of its top-level items are visible, and the upper left corner is placed at the specified location in the coordinate system provided by the component's parent.
If the x and y parameters are omitted, the menu is shown at its previous location.
The following example creates a menu from an XML menu object and calls the menu.show() method to display it.
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;
var my_xml:XML = new XML();
// Create items for the menu.
var newItem_obj:Object = my_xml.addMenuItem({label:"New"});
my_xml.addMenuItem({label:"Open", instanceName:"miOpen"});
my_xml.addMenuItem({label:"Save", instanceName:"miSave"});
my_xml.addMenuItem({type:"separator"});
my_xml.addMenuItem({label:"Quit", instanceName:"miQuit"});
// Create and show the menu.
var my_menu:Menu = Menu.createMenu(myParent_mc, my_xml);
my_menu.show(100, 20);
Flash CS3