Menu | Right button
Today in the Flash bar to see a flash on the realization of the right menu of the tutorial, I changed to become their own, in fact, very simple, and the site has several similar articles!
FLASH MX 2004 right button menu show
The application of Flash right-click menu
Example of the right mouse button menu
The effect of this time:
Click here to download the source file
The production method is very simple, directly add the following code to the first frame can be!
Defining related action instruction functions
Function tab () {
}
function Url1 () {
GetURL ("http://www.webjx.com", "_blank");
}
function Url2 () {
GetURL (http://www.webjx.com/ad.htm, "_blank");
}
function Url3 () {
GetURL ("http://wpa.qq.com/msgrd?V=1&Uin=76312395", "_blank");
}
Define exit Flash function (invalid on page)
function Quit1 () {
Fscommand ("Quit", "");
}
Define a Menu Object Expandmenu
var expandmenu = new ContextMenu ();
Hides all the built-in menu items in the specified ContextMenu object (except for "about").
Expandmenu.hidebuiltinitems ();
Define right-click menu
/* Usage
New Contextmenuitem (caption, Callbackfunction, [Separatorbefore, [Enabled, [visible]]]
Parameters
Caption The string that specifies the text associated with the menu item.
Callbackfunction The function you define, which is invoked when the menu item is selected.
Separatorbefore Boolean value that indicates whether the separator bar should appear above a specific menu item in the context menu. This parameter is optional, and its default value is False.
The enabled Boolean value that indicates whether a specific menu item in the context menu is enabled or disabled. This parameter is optional, and its default value is true.
Visible Boolean value that indicates whether the menu item is visible. This parameter is optional, and its default value is true.
*/
var $tab 1 = new Contextmenuitem ("Ad service:", tab, False, False, true);
var $url 1 = new Contextmenuitem ("Contact Us", url2);
var $tab 2 = new Contextmenuitem ("All Rights:", Tab, True, False, true);
var $url 2 = new Contextmenuitem ("-http://www.webjx.com-", URL1);
var $tab 3 = new Contextmenuitem ("Design by:", Tab, True, False, true);
var $url 3 = new Contextmenuitem ("Web Teaching", URL1);
var $tab 4 = new Contextmenuitem ("Chat with author QQ:", Tab, True, False, true);
var $url 4 = new Contextmenuitem ("76312395", URL3);
var $tab 5 = new Contextmenuitem ("Other Features", tab, True, False, true);
var $url 5 = new Contextmenuitem ("Exit", quit1);
Adds a new menu item to the ContextMenu object using the Customitems array expandmenu
Expandmenu.customItems.push ($tab 1, $url 1, $tab 2, $url 2, $tab 3, $url 3, $tab 4, $url 4, $tab 5, $url 5);
The context menu was invoked
Expandmenu.onselect = Menuhandler;
Associate a Expandmenu object with an object _root.menu
_root.menu = Expandmenu;
That ' s all