Page 1 of 1

Code Help for Swiping between cards

Posted: Wed Apr 26, 2017 6:20 pm
by cbeethjr
Hey y'all,

Still a complete beginner in terms of coding and I'm having some trouble figuring out how to swipe between cards. I would like to be able to touch anywhere except for a border along the top and bottom and be able to swipe left or right. Any code or help is greatly appreciated!

Thanks,
Clanton

Re: Code Help for Swiping between cards

Posted: Sat Apr 29, 2017 2:49 pm
by ittarter
Hey,

Is this what you're looking for?

Code: Select all

global sStartH
on mouseDown
   put the mouseH into sStartH
end mouseDown

on mouseUp
   if abs(the mouseH - sStartH) > 50 then
       if the mouseH < sStartH then
           goNext
       else
           goPrev
       end if
   end if
end mouseUp

command goNext
   go next cd
end goNext

command goPrev
   go prev cd
end goPrev
Let me know if it works as I'd like to use it myself when I modify my app to be compatible with touchscreen.

Regards,

Ivan

Re: Code Help for Swiping between cards

Posted: Wed May 10, 2017 8:44 pm
by MaxV