Swipe to Go to Next/Previous Scene and Play Air for iOS
Hi, I am using this action script to create a simple swipe App.
/* Swipe to Go to Next/Previous Scene and Play
Swiping the stage moves the playhead to the next/previous scene in the timeline and continues playback in that scene.
*/
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_5);
function fl_SwipeToGoToNextPreviousScene_5(event:TransformGestureEvent):void
{
if(event.offsetX == 1)
{
// swiped right
prevScene();
}
else if(event.offsetX == -1)
{
// swiped left
nextScene();
}
}
This works fine if I only have two scenes but I have more than that. At the moment it will reset to the start and not go past scene 2.
Do I need to amend this code here?
if(event.offsetX == 1)
{
// swiped right
prevScene();
}
else if(event.offsetX == -1)
{
// swiped left
nextScene();
}
}
Any advice would be helpful.
Thanks
