Swipe question.

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
atmosk
Posts: 32
Joined: Wed Feb 27, 2013 5:50 pm

Swipe question.

Post by atmosk » 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.

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
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.

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

Re: Swipe question.

Post by Dixie » Wed Feb 27, 2013 7:00 pm

the end result is the same... here is an example using the 'touch' command...

be well

Dixie

Edit : make sure that you post to the correct forum... or Klaus will shout at you !... :(
Attachments
swipes.livecode.zip
(2.21 KiB) Downloaded 206 times

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Swipe question.

Post by Klaus » Wed Feb 27, 2013 7:04 pm

I gave up in this respect... 8)

atmosk
Posts: 32
Joined: Wed Feb 27, 2013 5:50 pm

Re: Swipe question.

Post by atmosk » Wed Feb 27, 2013 7:23 pm

Dixie wrote:the end result is the same... here is an example using the 'touch' command...

be well

Dixie

Edit : make sure that you post to the correct forum... or Klaus will shout at you !... :(
Thanks, works awesome and also learned tons of new stuff.
I thought this was the place to ask dumb beginners questions, sorry :(

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Swipe question.

Post by Klaus » Thu Feb 28, 2013 2:59 pm

No need to excuse, atmosk!

This is of course misleading, we have a special "iOS"and "Android" forum, but one need to scroll down this page to see them
and "Getting Started with LiveCode - Complete Beginners" is right on the top of the page and has this "inviting" description:
"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!"

:D


Best

Klaus

Post Reply