mMenu.addItem()

Availability

Windows: Flash 8 or 9 AS2.0 SWF + mProjector 3.0; Windows 98/ME/NT Support: Flash 7 SWF + mProjector 2.0 build "e4";

Macintosh: Flash 8 or 9 AS2.0 SWF + mProjector 1.0;

Usage

mMenu.addItem(description:String[, menuName:String][, shortcut:String]) : Void

Parameters

description - Description of the menu item to add.

menuName - Optional; Menu to which item will be added. On Windows, mMenu commands operate on the right-click menu and system tray menu. On the Mac, mMenu commands operate on the right-click menu (cntl-click menu for systems with a one mouse button) or menus in the application's menu bar. Specify nothing or "Right Click Menu" to modify the right-click menu (or cntl-click menu for Mac systems using a single button mouse). Specify "System Tray Menu" to modify the Windows right-click system tray menu. Specify "File", "Edit", "Window", and "ApplicationName" to modify the default Mac application menus.

shortcut - Optional; Keyboard shortcut (MAC ONLY, version 3.0.5 or later)

Many shortcut keys on the Mac are not detected by Flash's onKeyDown handler -- e.g. CMD key. To enable popular Mac shortcuts, include a coded description of the desired key command and mProjector will trigger a mMenu.onCommand event when the key sequence is detected. Construct the key command string using the following coded strings in a "-" separated list.

For example, if your application includes a "Help" menu item, and you want it to be triggered by the standard Mac help keyboard shortcut, pass the value "CMD-?".

Returns

Nothing.

Description

Method; Adds a new item to a menu. The menu item will be added below any existing menu items, but above any built-in menu items.

Example

The following example adds a new menu item that will be used to initiate user registration.

mMenu.addItem("Register", "Right Click Menu");

mMenu.onCommand = function(menuName, menuItem) {
	if (menuName == "Right Click Menu") {
		if ((itemName == "Register") {
			//do registration
		}
	}
};

See Also

Using mProjector -- Menus, mMenu.createMenu(), mMenu.addMenuToMenuBar(),

Code Examples

mProjector Class Basics -- mMenu, Context Sensitive Menus