主题:  mouseup 和doubleClick

linda928

职务:普通成员
等级:1
金币:0.0
发贴:54
注册:2001/5/11 8:55:37
#12001/7/9 16:56:30
请问,如何使mouseup和doubleClick 共存,也就是判断了是双击还是单击,再触发事件。

编辑历史:[这消息被linda928编辑过(编辑时间2001-07-09 16:58:23)]


wangzj

职务:普通成员
等级:1
金币:0.0
发贴:166
注册:2001/5/25 17:31:16
#22001/7/9 17:59:37
if doubleClick = TRUE then
--event
else
--event
end if
我是这么想,不知是否可行.



linda928

职务:普通成员
等级:1
金币:0.0
发贴:54
注册:2001/5/11 8:55:37
#32001/7/9 22:26:04
thanks



cx

职务:普通成员
等级:1
金币:0.0
发贴:49
注册:2001/4/8 20:33:41
#42001/7/9 23:12:46
不行啊!请教大家



littleboy_5d

职务:普通成员
等级:1
金币:0.0
发贴:104
注册:2000/11/13 16:05:12
#52001/7/10 9:09:55
on mouseUp me
if the doubleclick=TRUE then
-----你想在鼠标双击时执行的事件
end if



cx

职务:普通成员
等级:1
金币:0.0
发贴:49
注册:2001/4/8 20:33:41
#62001/7/10 19:45:10
我的意思是:在一个按钮上,单击触发一个事件,双击触发另一个事件,用了if then....else...,好象不管用,只认单击,求各位朋友指教



sAvage.Tang

职务:普通成员
等级:1
金币:0.0
发贴:26
注册:2001/7/10 20:09:16
#72001/7/10 20:22:33
理论上是这样的:

global clicknum
on mouseDown me
clicknum = 1
end mouseDown

on mouseUP me
if lastEvent=xxx then
clicknum = 2
end if
end mouseUP

on mouseLeave me
clicknum=0
end

on exitFrame me
if clicknum=1 then
....
else if clicknum=2 then
...
end

语句中xxx是自己设定的时间,表示按下和释放之间的时间间隔。
本人也未试过,可能是个笨办法,不妨一试,如果成功了别忘了告诉了哦。



sAvage.Tang

职务:普通成员
等级:1
金币:0.0
发贴:26
注册:2001/7/10 20:09:16
#82001/7/10 20:44:35
刚才的程序好象有些问题



sAvage.Tang

职务:普通成员
等级:1
金币:0.0
发贴:26
注册:2001/7/10 20:09:16
#92001/7/10 20:48:25
我的思路是:

on mouseUP me
clicknum=click+1
启动记时器
end mouseUP

on exitFrame me
if 记时器到点 then
if clicknum=1 then
--"click"
clicknum=0
记时器清0
else if clicknum=2 then
---"double click"
clicknum=0
记时器清0
end if
end



sAvage.Tang

职务:普通成员
等级:1
金币:0.0
发贴:26
注册:2001/7/10 20:09:16
#102001/7/10 21:54:34
不好意思,前面的程序是错误的。

我新贴了一个贴子,倒那里去拿源程序吧,已经通过测试了。



wws2000

职务:普通成员
等级:1
金币:1.0
发贴:126
注册:2000/9/18 21:30:19
#112001/7/12 7:27:13
cx在上个贴子中说
引用:
我的意思是:在一个按钮上,单击触发一个事件,双击触发另一个事件,用了if then....else...,好象不管用,只认单击,求各位朋友指教


有那么复杂吗?为什么把if then....else...放在on mouseup里呢,我都是放在on mousedown里,用起来没有什么问题可以区别单击和双击从而执行不同的命令。

on mousedown me
if the doubleclick then
event
else
event
end if
end

这样不就可以了吗?



cx

职务:普通成员
等级:1
金币:0.0
发贴:49
注册:2001/4/8 20:33:41
#122001/7/12 22:56:01
wws2000:你去试一下,好吗?