Skip to main content
Known Participant
June 25, 2021
Question

Help Please

  • June 25, 2021
  • 1 reply
  • 401 views

Could someone please tell me the code to how to stop the swipe when on a diffrent scene 

test1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_9);

function fl_ClickToGoToScene_9(event:MouseEvent):void
{
MovieClip(this.root).gotoAndPlay(1, "Scene 2");
}


/* Swipe to Go to Next/Previous Frame and Stop
Swiping the stage moves the playhead to the next/previous frame and stops the movie.
*/

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

function fl_SwipeToGoToNextPreviousFrame_30(event:TransformGestureEvent):void
{
if(event.offsetX == 1)
{
// swiped right
gotoAndPlay(2);
}
else if(event.offsetX == -1)
{
// swiped left
gotoAndPlay(1);
}
}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 25, 2021

use removeEventListener to remove event listeners:

 

stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

Known Participant
June 25, 2021

Hi Thank you heaps  for getting back to me where do I put the code? Im still using code snippits, do I put it in the scene where I want it to stop,?  could you please please type the code exacly how to put in I am not very good at it. Thanks again for getting back to me. 🙂  

kglad
Community Expert
Community Expert
June 25, 2021

put this:

 

stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

 

where you want the swipe to no longer work.