7 Replies Latest reply on Jun 16, 2016 6:22 AM by kglad

    how to active swipe function at previous frame?

    aristriyanto

      i use script below, the problem is the function at previous frame is not working, its always run command at last frame, pls help me, tq

       

      *at frame 1

       

      Multitouch.inputMode = MultitouchInputMode.GESTURE;

      stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_a);

      function fl_SwipeToGoToNextPreviousScene_a(event:TransformGestureEvent):void

       

      {

        if(event.offsetX == 1)

        {

        // swiped right

        stop();

        }

       

        else if(event.offsetX == -1)

        {

        // swiped left

        gotoAndPlay(2);

        }

      }

       

      *at frame 10

       

      Multitouch.inputMode = MultitouchInputMode.GESTURE;

      stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_b);

      function fl_SwipeToGoToNextPreviousScene_b(event:TransformGestureEvent):void

       

      {

        if(event.offsetX == 1)

        {

        // swiped right

        gotoAndPlay(2);

        }

       

        else if(event.offsetX == -1)

        {

        // swiped left

        gotoAndPlay(11);

        }

      }

       

      *at frame 20

       

      Multitouch.inputMode = MultitouchInputMode.GESTURE;

      stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_c);

      function fl_SwipeToGoToNextPreviousScene_c(event:TransformGestureEvent):void

       

      {

        if(event.offsetX == 1)

        {

        // swiped right

        gotoAndPlay(11);

        }

       

        else if(event.offsetX == -1)

        {

        // swiped left

        gotoAndPlay(21);

        }

      }

       

      *at frame 40

       

      Multitouch.inputMode = MultitouchInputMode.GESTURE;

      stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousScene_d);

      function fl_SwipeToGoToNextPreviousScene_d(event:TransformGestureEvent):void

       

      {

        if(event.offsetX == 1)

        {

        // swiped right

        gotoAndPlay(21);

        }

       

        else if(event.offsetX == -1)

        {

        // swiped left

        gotoAndStop(40);

        }

      }

       

       

      Capture.PNG