`
hgfghwq24
  • 浏览: 27479 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
最近访客 更多访客>>
社区版块
存档分类
最新评论

AS3生成单独“双击事件”

阅读更多

 AS3虽然提供了双击事件,但在触发双击事件之前会触发一个单击事件,这给编写游戏的朋友带来了很多不便,于是还是自己再加入写判断来生成单一的事件,也就是有双击事件的时候就没有单击事件,有单击事件的时候就没有双击事件。代码如下:
mc.doubleClickEnabled=true
mc.addEventListener(MouseEvent.CLICK,chick)
mc.addEventListener(MouseEvent.DOUBLE_CLICK,double)
var sta=false
function double(e){ 
 sta=true
}
function chick(e){
 sta=false
 var time=new Timer(260,1)
 time.start()
 time.addEventListener(TimerEvent.TIMER,func) 
}
function func(e){ 
 if(sta){  
  trace("双击")
 }else{
  trace("单击")
 } 
}
本文转自:http://www.5uflash.com/flashjiaocheng/Fmsjiaocheng/1971.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics