View Full Version : launching scenes based on direction of touch (swipe)

23 Mar 2012, 12:57 PM
I am trying to do the following:

user swipes touch area to the left = launches scene 1
user swipes touch area to the right = launches scene 3

Kinda like a carousel, I just need to register the direction of the swipes and launch the appropriate scenes.

Any help would be awesome!

26 Mar 2012, 7:21 AM
Here is a gesture class from Sencha Touch 2 that detects horizontal swipes
That might give you some inspiration to get started.

29 Mar 2012, 10:16 AM
That's great stuff. Thanks for the link. Do you have an example of how I can modify this script to tie it to a scene change? That's the part that I am having difficulty. any help is GREATLY appreciated!

29 Mar 2012, 10:45 AM
I can give you a couple of high level pointers of one potential solution.

I'd write a swipe script and make it listen on the document for swipes. You can include this script by adding a script tag and referencing it in Animator in the properties side panel under Project -> Head HTML.

Then on your first scene, you can add a start action, in the start action you can connect the animation controller to your script. E.g.

then in your swipe script you'd store the reference to the animation controller, and you can call
animationController.goToSceneByID(); etc to control the animation.