Swipe question.
Posted: Wed Feb 27, 2013 6:04 pm
I started using livecode about couple days ago for an app and among the first things I attempted to do was swiping from card 2-4 (sub menus) back to card 1 (main menu).
Currently I have this.
It works on most pretty decently, given a few problems which I've figured already and I imagine others as well with some tinkering.
Now, my question is how would other people go about doing this? Is there perhaps a swipe message I could read in instead? Having the above code in virtually every card and control would get a bit too heavy? As a btw, the target platform currently is android/iOS.
Currently I have this.
Code: Select all
on openCard
global startingPositionX,startingPositionY
end openCard
on mousedown
global startingPositionX,startingPositionY
put the mouseH into startingPositionX
put the mouseV into startingPositionY
end mouseDown
on mouseStillDown
global startingPositionX,startingPositionY
local distanceX, distanceY
put abs (the mouseH - startingPositionX) into distanceX
put abs (the mouseV - startingPositionY) into distanceY
if distanceX > 200 then
go to card "Main Menu"
end if
end mouseStillDown
Now, my question is how would other people go about doing this? Is there perhaps a swipe message I could read in instead? Having the above code in virtually every card and control would get a bit too heavy? As a btw, the target platform currently is android/iOS.