End a touchMove

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

End a touchMove

Post by doobox » Tue May 28, 2013 1:06 am

Hi there,

Is it possible to end a touch move while the users touch has not yet lifted..?

My scenario is like this :

User touches -- I handle touchStart

User finger moves -- i am handling the touchMove messages, during the move if the finger moves more than a desired number of pixels i fire off a function from within the touchMove handler.

I want to end the messages for this touchMove and fire the touchEnd, and i dont want to hear any more move messages until the finger is lifted and re-touched so i had thought --

on touchMove
if my arbitrary move has been exceeded then
function myfunctioncall() // blocking
send touchEnd to this card in 10 milliseconds
exit to top
end if
end touchMove

This works but causes unpredictable crashing, so i am certainly doing something wrong here..?
Kind Regards
Gary

https://www.doobox.co.uk

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: End a touchMove

Post by Dixie » Tue May 28, 2013 2:18 am

Gary...

I don't know if this will help, but I've attached a stack that uses the 'touch' commands to swipe. If you have a look at the 'touch' commands in the stack script, you will notice that nothing will happen until a finger swipe has traveled a 100 pixels... whether going from left to right, or right to left... you will notice that nothing will happen if the 'swipe' is less than 100 pixels...

But everything happens in the 'touchMove' handler and I don't have to worry about the 'touchEnd' command'

Dixie
Attachments
swipes.livecode.zip
(2.12 KiB) Downloaded 198 times

Post Reply