Android motion events... a good shake!

Nicolas Cueto niconiko at gmail.com
Wed Jun 20 07:27:50 EDT 2012


Sorry to post again so soon. But just had another idea. Which seems to
work. But maybe there's a problem I'm overlooking?

Here it is:

/////////////////////////////////////////////////////////////////////////////////

local tShakes_Tally, tShakes_Time

on motionStart
   if tShakes_Time is not empty and the milliseconds - tShakes_Time > 1000 then
      put empty into tShakes_Tally
   end if
   put the milliseconds into tShakes_Time
end motionStart

on motionEnd
   add 1 to tShakes_Tally
   put tShakes_Tally into field "tNumberOfShakes"
   if tShakes_Tally >= 5 then
      put empty into tShakes_Tally
      send doTheChange to me in 0 milliseconds
   end if
end motionEnd

//////////////////////////////////////////////////////////////////



If there's a more reliable way...


Cheers.
--
Nicolas Cueto




More information about the use-livecode mailing list