Leya 发表于 2008-3-28 10:15:22

FLASH右键菜单的应用

//核心代码如下:

//引用内容
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://www.tianxia.cc/blog/", "_blank");
}
_root.menu = empiremue;


原文件下载:(转)

http://www.flashempire.com/school/img4/04011402.fla
Danger写的Flash右键菜单生成器!
http://dengjie.com/temp/fcb_cn.swf

http://www.dengjie.com/weblog/comments.asp?post_id=1149


屏蔽flash右键菜单

1.在flash player中有效,在网页中无效:
fscommand("showmenu",fasle)


2.在网页中flash的位置加入参数:
param name="menu" value="false">

3.在flash的第一帧加入action,这个方法最简单:
stage.showmenu=false;


4.让flash的右键放大、缩小菜单失效,基本上等于屏蔽右键了。在flash的第一帧加入action:
right = new object();
right.!#111nmousemove = function() {
stage.scalemode = "noscale";
};
mouse.addlistener(right);


5.danger的方法,这个适合用在没有交互的动画上,如果需要交互的话这个方法不行。在flash的第一帧加入action:
_root.createtextfield("danger", 999, 0, 0, stage.width, stage.height);

6.在html文件中添加如下代码:


程序代码
body oncontextmenu="return false">

button disabled style="width:450px;height:350px;border:0">
!--Flash文件-->
object... ...>
... ...
param name="wmode" value="Opaque">//注意,加上这一句
... ...
embed ... ...> /embed>
/object>
!--Flash文件:结束-->
/button>


-----------------------------------
总结:
1、body里禁止右键。
2、将Flash文件插入到Button控件里,设置button控件的Disabled属性。Button控件的宽高为你想要显示Flash动画的宽高...
3、在Flash文件里,加入一句 param name="wmode" value="Opaque">就OK了

这是彻底屏蔽,没有任何菜单显示,就像不是Flash格式的文件一样。可以作成模拟的应用程序界面,让人搞不清是用什么插件制作的

7. FLASH右键菜单屏蔽和自定意义
my_cm = new ContextMenu();
// 申明一个新的菜单对象
my_cm.hideBuiltInItems();
// 屏敞当前的右键菜单my_cm.customItems.push(new ContextMenuItem("焚天博客", menu1));
// 创建一个新的子菜单,名为“焚天博客”,并设置menu1为响应函数
function menu1(obj, item) {
trace("焚天博客");
getURL("http://www.tianxia.cc/blog/", "_blank");
// “焚天博客”的响应函数具体内容
}
_root.menu = my_cm;
// 将当前定义的菜单绑定到主场景的右键菜单上
页: [1]
查看完整版本: FLASH右键菜单的应用