menu (MovieClip.menu property)

public menu : ContextMenu

Associates the specified ContextMenu object with the movie clip. The ContextMenu class lets you modify the context menu that appears when the user right-clicks (Windows) or Control-clicks (Macintosh) in Flash Player.

Availability: ActionScript 1.0; Flash Player 7

Example

The following example assigns the menu_cm ContextMenu object to the image_mc movie clip. The ContextMenu object contains a custom menu item labeled "View Image in Browser" that has an associated function named viewImage():

var menu_cm:ContextMenu = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem("View Image in Browser...", viewImage));
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
    target_mc.menu = menu_cm;
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("photo1.jpg", image_mc);

function viewImage(target_mc:MovieClip, obj:Object) {
    getURL(target_mc._url, "_blank");
}

When you right-click (Windows) or Control-click (Macintosh) the image at runtime, select View Image in Browser from the context menu to open the image in a browser window.

See also

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


Flash CS3