大众计算机学习网

专门提供各种电脑教程

可参考的自定义flash右键菜单源代码

Admin | 2008-6-12 20:51:31 | 被阅次数 | 7238

my_cm = new ContextMenu();
// 申明一个新的菜单对象
my_cm.hideBuiltInItems();
// 屏敞当前的右键菜单
my_cm.customItems.push(new ContextMenuItem("大众计算机学习网", menu1));
// 创建一个新的子菜单,名为“大众计算机学习网”,并设置menu1为响应函数
function menu1(obj, item) {
  trace("大众计算机学习网");
  getURL("http://www.dzwebs.net", "_blank");
  // “大众计算机学习网”的响应函数具体内容
}
_root.menu = my_cm;
// 将当前定义的菜单绑定到主场景的右键菜单上

var my_cm:ContextMenu = new ContextMenu(); 
my_cm.hideBuiltInItems(); 
//my_cm.builtInItems.quality = true; 
//my_cm.builtInItems.print = true; 
my_cm.customItems.push(new ContextMenuItem("网址①", sktt)); 
my_cm.customItems.push(new ContextMenuItem("网址②", skdg, false)); 
my_cm.customItems.push(new ContextMenuItem("网址③", xiatian)); 
this.menu = my_cm; 
function sktt() { 
  getURL("http://xxx.xxx.xxx/", "_blank"); 
  } 
function skdg() { 
  getURL("http://xxx.xxx.xxx", "_blank"); 

function xiatian() { 
  getURL("http://xxx.xxx.xxx", "_blank"); 

var empiremue = new ContextMenu();
//删除原始菜单状态!
empiremue.hideBuiltInItems();
//自定义菜单项目!
empiremue.customItems.push(new ContextMenuItem("返回首界面", home));
empiremue.customItems.push(new ContextMenuItem("返回到一副", h1));
empiremue.customItems.push(new ContextMenuItem("返回到二副", h2));
empiremue.customItems.push(new ContextMenuItem("返回到三副", h3));
empiremue.customItems.push(new ContextMenuItem("返回到四副", h4));
empiremue.customItems.push(new ContextMenuItem("返回到五副", h5));
empiremue.customItems.push(new ContextMenuItem("返回到六副", h6));
empiremue.customItems.push(new ContextMenuItem("去大众计算机学习网学习", gotoempire));
//菜单子程序执行目标...
function home() {
_root.gotoAndStop(1);
}
function h1() {
_root.gotoAndStop(2);
}
function h2() {
_root.gotoAndStop(3);
}
function h3() {
_root.gotoAndStop(4);
}
function h4() {
_root.gotoAndStop(5);
}
function h5() {
_root.gotoAndStop(6);
}
function h6() {
_root.gotoAndStop(7);
}
function gotoempire() {
getURL("http://xxx.xxx.xxx", "_blank");
}
_root.menu = empiremue;