Page 1 of 1

How to detect long touch on mobile

Posted: Thu Feb 13, 2014 4:05 pm
by terryho
Hi all,

I want to detect long touch on mobile device, when long touch pop up a group for user select.

But i try the following code, it does not work :

on mouseDown
// make sure to handle any visual stuff here first, if necessary
wait 300 millisecs with messages
if the mouse is down then
// treat like long mouseClick
else
// treat like short mouseClick
end if
end mouseDown

Please advice, may be I use wrong method

Regards

Terry Ho

Re: How to detect long touch on mobile

Posted: Thu Feb 20, 2014 5:50 am
by FabricioRocha
I was looking for an example as well, Terry, and I found this thread:

http://forums.runrev.com/viewtopic.php? ... hilit=long

I would also like to try the suggestion made there by jacque: save the time on touchStart in a script variable, get the time at touchEnd, compare these times and, if the difference is bigger than a certain amount, generate a message which could start an "on longtouch" handler.

Re: How to detect long touch on mobile

Posted: Tue Feb 25, 2014 4:09 pm
by terryho
Hi

Thanks your suggestion on checking on timer, I will try it.

Regards

Terry Ho

Re: How to detect long touch on mobile

Posted: Tue Feb 25, 2014 5:33 pm
by jmburnod
Hi Terry,

Here is a stack with two methods using duration of mousedown

Best regards
Jean-Marc