Copy link to clipboard
Copied
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);
}
}
Copy link to clipboard
Copied
use removeEventListener to remove event listeners:
stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);
Copy link to clipboard
Copied
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. š
Copy link to clipboard
Copied
put this:
stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);
where you want the swipe to no longer work.
Copy link to clipboard
Copied
I am Code illiterate it did not work
Copy link to clipboard
Copied
the code works. you're not putting it in the correct location and i determine where your putting it and why it's not doing what you want.
but if you only the code to work once and then not again use:
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);}
}
stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);
}
Copy link to clipboard
Copied
Thank you
Copy link to clipboard
Copied
you're welcome