Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Help Please

Explorer ,
Jun 24, 2021 Jun 24, 2021

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

use removeEventListener to remove event listeners:

 

stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

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 ,
Jun 25, 2021 Jun 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. šŸ™‚  

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

put this:

 

stage.removeEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame_30);

 

where you want the swipe to no longer work.

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

I am Code illiterate it did not work 

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

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

}

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

Thank you 

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