ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > ContextMenuItem > onSelect (ContextMenuItem.onSelect handler) | |||
Invoked when the specified menu item is selected from the Flash Player context menu. The specified callback handler receives two parameters: obj, a reference to the object under the mouse when the user invoked the Flash Player context menu, and item, a reference to the ContextMenuItem object that represents the selected menu item.
Availability: ActionScript 1.0; Flash Player 7
obj:Object - A reference to the object (movie clip, Timeline, button, or selectable text field) on which the user right or Control clicked.
menuItem:Object - A reference to the selected ContextMenuItem object.
The following example determines over what type of object the context menu was invoked.
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;
onSelect (ContextMenu.onSelect handler)
|
|
|
|