Contextmenu.onselect - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

ContextMenu.onSelect

Availability
Flash Player 7.
Usage
my_cm.onSelect = function (item:Object, item_menu:ContextMenu) : Void{
// your code here
}
Parameters
A reference to the object (movie clip, button, or selectable text field) that was under the
item
mouse pointer when the Flash Player context menu was invoked and whose
to a valid ContextMenu object.
A reference to the ContextMenu object assigned to the
item_menu
Returns
Nothing.
Description
Event handler; called when a user invokes the Flash Player context menu, but before the menu is
actually displayed. This lets you customize the contents of the context menu based on the current
application state.
You can also specify the callback handler for a ContextMenu object when you construct a new
ContextMenu object. For more information, see the
Example
The following example determines over what type of object the context menu was invoked:
my_cm = new ContextMenu();
function menuHandler(obj:Object, menu:ContextMenu) {
if(obj instanceof MovieClip) {
trace("Movie clip: " + obj);
}
if(obj instanceof TextField) {
trace("Text field: " + obj);
}
if(obj instanceof Button) {
trace("Button: " + obj);
}
}
my_cm.onSelect = menuHandler;
my_mc.menu = my_cm;
my_btn.menu = my_cm;
220
Chapter 2: ActionScript Language Reference
menu
ContextMenu class
entry.
property is set
menu
property of
.
object

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents