View comments | RSS feed

ContextMenu


Object
    |
    +-ContextMenu

public dynamic class ContextMenu
extends Object

The ContextMenu class provides runtime control over the items in the Flash Player context menu, which appears when a user right-clicks (Windows) or Control-clicks (Macintosh) on Flash Player. You can use the methods and properties of the ContextMenu class to add custom menu items, control the display of the built-in context menu items (for example, Zoom In and Print), or create copies of menus.

You can attach a ContextMenu object to a specific button, movie clip, or text field object, or to an entire movie level. You use the menu property of the Button, MovieClip, or TextField classes to do this. For more information about the menu property, see Button.menu, MovieClip.menu, and TextField.menu.

To add new items to a ContextMenu object, you create a ContextMenuItem object, and then add that object to the ContextMenu.customItems array. For more information about creating context menu items, see the ContextMenuItem class entry.

Flash Player has three types of context menus: the standard menu (which appears when you right-click in Flash Player), the edit menu (which appears when you right-click over a selectable or editable text field), and an error menu (which appears when a SWF file has failed to load into Flash Player.) Only the standard and edit menus can be modified with the ContextMenu class.

Custom menu items always appear at the top of the Flash Player context menu, above any visible built-in menu items; a separator bar distinguishes built-in and custom menu items. You can add no more than 15 custom items to a context menu. You cannot remove the Settings menu item from the context menu. The Settings menu item is required in Flash so users can access the settings that affect privacy and storage on their computers. You also cannot remove the About menu item from the context menu, which is required so users can find out what version of Flash Player they are using.

You must use the constructor new ContextMenu() to create a ContextMenu object before calling its methods.

Availability: ActionScript 1.0; Flash Player 7

See also

ContextMenuItem, menu (Button.menu property), menu (MovieClip.menu property), menu (TextField.menu property)

Property summary

Modifiers

Property

Description

 

builtInItems:Object

An object that has the following Boolean properties: zoom, quality, play, loop, rewind, forward_back, and print.

 

customItems:Array

An array of ContextMenuItem objects.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Event summary

Event

Description

onSelect = function(item:Object, item_menu:Object) {}

Called when a user invokes the Flash Player context menu, but before the menu is actually displayed.

Constructor summary

Signature

Description

ContextMenu([callbackFunction:Function])

Creates a new ContextMenu object.

Method summary

Modifiers

Signature

Description

 

copy() : ContextMenu

Creates a copy of the specified ContextMenu object.

 

hideBuiltInItems() : Void

Hides all built-in menu items (except Settings) in the specified ContextMenu object.

Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

Comments


matthewmayer said on Apr 4, 2006 at 9:14 PM :
If your custom menus aren't appearing, check that menus are not disabled. This could be caused by a menu="false" parameter in your HTML code, or by a call to Stage.showMenu=false;

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002096.html