如下代码不但可以去除原先的右健菜单,还可以自己定义,请根据自己需要而定吧
自定义FLASH右键菜单
请你点击右键看一下有什么效果:
我们只要把这段代码放在场景的一个图层中就可以实现以上效果:
var empiremue = new ContextMenu();
//删除原始菜单状态!
empiremue.hideBuiltInItems();//隐藏原来的菜单项目啊?(它是隐藏empiremue对象的所有内置菜单项,但“设置”除外,如:
my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
_root.menu = my_cm;
这个my_cm是自定义变量,在插入到网页时也起作用的,不像用fscommand()在插入网页时还
要设置参数; 当然隐藏FLASH菜单还可以用其它的AS的!)//自定义菜单项目!
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://www.flashempire.com/school/", "_blank");
}
_root.menu = empiremue;
这段代码是很好理解的,慢慢看一下!学东西记住不要只去用!
要弄明这代码为什么能实现这种效果!每一段函数所起的作用!
不明的可以发帖!用6.0版的朋友帮不了!
[此贴子已经被作者于2006-3-1 19:42:45编辑过]