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

Help Please

Explorer ,
Jun 24, 2021 Jun 24, 2021

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);
}
}

TOPICS
ActionScript

Views

252

Translate

Translate

Report

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

use removeEventListener to remove event listeners:

 

stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

Votes

Translate

Translate

Report

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 ,
Jun 25, 2021 Jun 25, 2021

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. 🙂  

Votes

Translate

Translate

Report

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

put this:

 

stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

 

where you want the swipe to no longer work.

Votes

Translate

Translate

Report

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

I am Code illiterate it did not work 

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

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);

}

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

Thank you 

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

LATEST

you're welcome 

Votes

Translate

Translate

Report

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