·您当前的位置:首页 > 技术教程 > AS2与AS3技术 >

[AS3]as3的鼠标动作mouseEnabled机制

时间:2016-06-01 11:17henhen928
[AS3]as3的鼠标动作mouseEnabled机制

看下面代码,本想在鼠标按下时就禁用对象的鼠标事件操作,但结果out事件还是执行了,out执行后禁用对象的鼠标事件才生效。这能不能算是API的BUG,这样从使用理解上、使用需求上好像都不方便,不知道为何会有这种结果???

  1. var spr:Sprite = new Sprite(); 
  2. spr.graphics.beginFill(0x999999); 
  3. spr.graphics.drawRoundRect(0, 0, 100, 20, 5, 5); 
  4. spr.graphics.endFill(); 
  5. spr.x = 300; 
  6. spr.y = 200; 
  7. spr.addEventListener(MouseEvent.MOUSE_DOWN, function (evt:MouseEvent):void 
  8. { 
  9.         spr.mouseEnabled = false; 
  10.         trace("down", spr.mouseEnabled); 
  11. }); 
  12. spr.addEventListener(MouseEvent.MOUSE_OUT, function (evt:MouseEvent):void 
  13. { 
  14.         trace("out", spr.mouseEnabled); 
  15. }); 
  16.  
  17. addChild(spr);  

[AS3]as3的鼠标动作mouseEnabled机制

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器