Page 1 of 1

Android Button - Long Press

Posted: Thu Aug 31, 2017 7:27 am
by Googie85
Hi Guys!

I am trying to get some code to work where a person holds a button in for 3 seconds on an Android device.

Any ideas would be welcomed greatly!

Googie.

Re: Android Button - Long Press

Posted: Thu Aug 31, 2017 10:18 am
by Klaus
Hi Googie,

out of my head:

Code: Select all

local tPressDuration

on mousedown
  put the millisecs into tPressDuration
end mousedown

on mouseup
  if the millisecs - tPressDuration >= 3000 then
      ### do your 3 seconds stuff
   else
     ## "normal" mouseup stuff here, if any
  end if
end mouseup
Or maybe use "touchstart" and "touchend", you get the picture...

Best

Klaus