ContextMenuItem.onSelect
Availability
Flash Player 7.
Usage
menuItem_cmi.onSelect = function (obj:Object, menuItem:ContextMenuItem) : Void
{
// your statements here
}
Parameters
A reference to the movie clip (or Timeline), button, or selectable text field that the user
obj
right-clicked or Control-clicked.
A reference to the selected ContextMenuItem object.
menuItem
Returns
Nothing.
Description
Event handler; invoked when the specified menu item is selected from the Flash Player context
menu. The specified callback handler receives two parameters:
under the mouse when the user invoked the Flash Player context menu, and
the ContextMenuItem object that represents the selected menu item.
Example
The following example assigns a function to the
object named
my_cmi
var my_cmi:ContextMenu = new ContextMenu();
var start_cmi:ContextMenuItem = new ContextMenuItem("Start");
start_cmi.onSelect = function(obj, item) {
trace("You chose: "+item.caption);
};
my_cmi.customItems.push(start_cmi);
my_cmi.customItems.push(new ContextMenuItem("Stop", stopHandler, true));
function stopHandler(obj, item) {
trace("Stopping...");
}
this.menu = my_cmi;
See also
ContextMenu.onSelect
528
Chapter 7: ActionScript for Flash
. The function writes the caption of the selected menu item to the log file.
, a reference to the object
obj
handler for a ContextMenuItem
onSelect
, a reference to
item
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?