再谈鼠标双击实现
我看到http://search.csdn.net/Expert/topic/2178/2178821.xml?temp=.2860987中讲述的鼠标双击实现方法后,我自己又写了一个实现方法希望对有这方面需要的有点帮助.
有兴趣的可以写个三击或者更多击鼠标事件来!
将下列代码拷进第一桢,再新建一个按钮,命名为bt即可测试!
j = 1;//初始j
t = 500;//双击在此时间内有效,单位:ms
bt.onRelease = function() {
j = -j;
if (j == -1) {
time1 = getTimer();
}
if (j == 1) {
time2 = getTimer();
time = Number(time2)-Number(time1);
trace(time)
if (time<=Number(t)) {
trace("++++++ok+++++");
}
}
};