I need to do something when users continue to hold down the mouse button, how do I do that? Looks like mouse clicked and mouse down events will only be trigger once, and will not be trggered again until users release and click the mouse button again.
Hi Wai Lee,
The mouse down event will be triggered when you press down the mouse button, and when you release the mouse button, the mouse up event will be triggered. So you can set a global property in the mouse down event handler, and reset the same property in the mouse up event handler, thus you could know whether the button is hold by checking that global property.
Also I think this article maybe helpful for you: http://www.foreui.com/doc/html/simula…
Thanks. I did what you suggested, it works fine on my computer, but on touch-screen tablet (I tested it on iPad and Samsung Galaxy), it either does not work, or the system has its own behaviour on held-down touch.
BTW, what is the differences between global_mouse_down at the page level and the mouse_down at the element level?
I haven’t tried that on tablets, I guess they have different event for held-down touch.
The mouse down event at element level will be triggered only when you click on the element, while the global mouse down event will be triggered no matter where you click on the page.
OK thanks a lot.
This question is now closed