[AS3]禁掉flash player右键菜单的方法,取消as3右键链接
[AS3]禁掉flash player右键菜单的方法,取消as3右键链接,下面这个例子演示了右键支持以及到底什么是鼠标坐标锁定。点击鼠标左键全屏观察鼠标锁定效果。右键取消全屏。
下面这个例子演示了右键支持以及到底什么是鼠标坐标锁定。点击鼠标左键全屏观察鼠标锁定效果。右键取消全屏。
- package
- {
- import flash.display.Sprite;
- import flash.display.StageDisplayState;
- import flash.events.MouseEvent;
- import flash.text.TextField;
- /**
- * Flash Player鼠标右键支持
- * @author zrong(zengrong.net)
- * 创建日期:2012-02-28
- */
- [SWF(width=500,height=400)]
- public class RightClick extends Sprite
- {
- public function RightClick()
- {
- _traceTF = createTF();
- _traceTF.width = this.stage.stageWidth*.5;
- _traceTF.height = this.stage.stageHeight;
- _traceTF.text = 'cuplayer.com提示左键全屏观察鼠标锁定效果。右键取消全屏。\n';
- this.addChild(_traceTF);
- _locTF = createTF();
- _locTF.width = 100;
- _locTF.height = this.stage.stageHeight;
- _locTF.x = 400;
- this.addChild(_locTF);
- this.stage.doubleClickEnabled = true;
- this.stage.addEventListener(MouseEvent.CLICK, handler_mouseEvent);
- this.stage.addEventListener(MouseEvent.RIGHT_CLICK, handler_mouseEvent);
- this.stage.addEventListener(MouseEvent.MOUSE_MOVE, handler_mouseMove);
- }
- private var _traceTF:TextField;
- private var _locTF:TextField;
- private function createTF():TextField
- {
- var __tf:TextField = new TextField();
- __tf.selectable = false;
- __tf.mouseEnabled = false;
- __tf.wordWrap = true;
- return __tf;
- }
- private function handler_mouseMove($evt:MouseEvent):void
- {
- showLoc($evt.movementX, $evt.movementY);
- }
- private function handler_mouseEvent($evt:MouseEvent):void
- {
- showTrace($evt.type);
- if($evt.type == MouseEvent.CLICK)
- {
- this.stage.displayState = StageDisplayState.FULL_SCREEN;
- this.stage.mouseLock = true;
- }
- else
- {
- this.stage.displayState = StageDisplayState.NORMAL;
- }
- showTrace('fullscreen:'+this.stage.displayState);
- }
- private function showTrace($msg:String):void
- {
- _traceTF.appendText($msg + '\n');
- _traceTF_traceTF.scrollV = _traceTF.maxScrollV;
- }
- private function showLoc($x:Number, $y:Number):void
- {
- _locTF.appendText($x+','+$y+'\n');
- _locTF_locTF.scrollV = _locTF.maxScrollV;
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...