[AS3]as3鼠标事件MouseEvent添加监听器代码
[AS3]as3鼠标事件MouseEvent添加监听器代码:为KeyboardEvent事件添加监听器和关联处理方法
[AS3]as3鼠标事件MouseEvent添加监听器代码:为MouseEvent系列事件添加监听器和关联处理方法
- package hxw
- {
- import flash.display.Sprite;
- import flash.events.MouseEvent;
- [SWF(width="800", height="600", backgroundColor="#869CA7", frameRate="31")]
- public class Sample1010 extends Sprite
- {
- private var _sprite:Sprite;
- public function Sample1010()
- {
- _sprite = new Sprite();
- _sprite.graphics.beginFill(0x27496E);
- _sprite.graphics.drawRect(5,5,400,400);
- _sprite.graphics.endFill();
- _sprite.addEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);
- _sprite.addEventListener(MouseEvent.MOUSE_UP,OnMouseUp);
- //极酷网页视频播放器
- this.addChild(_sprite);
- }
- private function OnMouseDown(event:MouseEvent):void
- {
- _sprite.graphics.lineStyle(1,0xFFFF00,1);
- _sprite.graphics.moveTo(mouseX,mouseY);
- _sprite.addEventListener(MouseEvent.MOUSE_MOVE,OnMouseMove);
- }
- private function OnMouseUp(event:MouseEvent):void
- {
- _sprite.removeEventListener(MouseEvent.MOUSE_MOVE,OnMouseMove);
- }
- private function OnMouseMove(event:MouseEvent):void
- {
- _sprite.graphics.lineTo(mouseX,mouseY);
- }
- }
- }
热门文章推荐
- [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示例
请稍候...