Visible (Contextmenuitem.visible Property) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
This example creates three menu items, labeled Open, Save, and Print. A separator bar divides
the Save and Print items. The menu items are then added to the ContextMenu object's
array. Finally, the menu is attached to the current Timeline of the SWF file.
customItems
var my_cm:ContextMenu = new ContextMenu();
var open_cmi:ContextMenuItem = new ContextMenuItem("Open", itemHandler);
var save_cmi:ContextMenuItem = new ContextMenuItem("Save", itemHandler);
var print_cmi:ContextMenuItem = new ContextMenuItem("Print", itemHandler);
print_cmi.separatorBefore = true;
my_cm.customItems.push(open_cmi, save_cmi, print_cmi);
function itemHandler(obj, menuItem) {
trace("You chose: " + menuItem.caption);
};
this.menu = my_cm;
See also
onSelect (ContextMenu.onSelect handler)

visible (ContextMenuItem.visible property)

public visible : Boolean
A Boolean value that indicates whether the specified menu item is visible when the Flash
Player context menu is displayed. By default, this property is
Availability: ActionScript 1.0; Flash Player 7
Example
The following example creates two new context menu items: Start and Stop. When the user
selects Start, the number of milliseconds from when the SWF file started is displayed. Start is
then made invisible in the menu. When Stop is selected, the number of milliseconds that have
elapsed since the SWF file started is displayed. The Start menu item is made visible and the
Stop menu item is made invisible.
var my_cm:ContextMenu = new ContextMenu();
var startMenuItem:ContextMenuItem = new ContextMenuItem("Start",
startHandler);
startMenuItem.visible = true;
my_cm.customItems.push(startMenuItem);
var stopMenuItem:ContextMenuItem = new ContextMenuItem("Stop", stopHandler,
true);
stopMenuItem.visible = false;
my_cm.customItems.push(stopMenuItem);
function stopHandler(obj, item) {
trace("Stopping... "+getTimer()+"ms");
startMenuItem.visible = true;
456
ActionScript classes
.
true

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents