Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Swipe to Go to Next/Previous Scene and Play Air for iOS

Explorer ,
Sep 13, 2015 Sep 13, 2015

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

TOPICS
ActionScript
707
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 15, 2015 Sep 15, 2015

you need to add a stop() to each scene.

Translate
Community Expert ,
Sep 15, 2015 Sep 15, 2015

you need to add a stop() to each scene.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 15, 2015 Sep 15, 2015

Thank you, will give it a try.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2015 Sep 15, 2015
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines