Skip to main content
Inspiring
April 10, 2019
Answered

Swipe event controls timeline

  • April 10, 2019
  • 1 reply
  • 720 views

Hi!...

I am sorry about my silly questions but i really need your help...

I need to create an app for a touch screen where I move the screen along a landscape where I will have buttons with some information. The problem is I would like to move the landscape swiping the finger on a touch screen.

Is there any way I can use a swipe event to change frames along the time line? if so is there a way I can control only part of the timeline? I need to have some places (frames) where the swipe doesn't work.

I want to publish with AIR for desktop and I am using the latest animate cc (19.2) andI have been trying to use this code but it's not working very well...

stage.addEventListener(MouseEvent.MOUSE_DOWN, mDown);

stage.addEventListener(MouseEvent.MOUSE_UP, mUp);

var prevMouseX:int;

function mDown(event:MouseEvent):void {

prevMouseX = stage.mouseX;

   this.addEventListener(Event.ENTER_FRAME,mMove);

}

function mUp(event:MouseEvent):void {

   this.removeEventListener(Event.ENTER_FRAME,mMove);

}

function mMove(event:Event):void {

              

        var activeMouseX = stage.mouseX;

     

        if (activeMouseX > prevMouseX){

            if(currentFrame == 1){

                gotoAndStop(totalFrames);

            } else {

                prevFrame()

            }

        }

        if (activeMouseX < prevMouseX){

            if(currentFrame == totalFrames) {

                gotoAndStop(1);

            } else {

                nextFrame()

            }

        }

prevMouseX = stage.mouseX

    This topic has been closed for replies.
    Correct answer ATGB

    Ok, I found a way to do it... using scenes and this same code to move the movie along the time line... If anyone can give me some opinion or more ideas about how to do it in a better way I would appreciate.

    Thank you all for your help

    ... and once again I'm sorry if the questions are really silly...

    1 reply

    ATGBAuthorCorrect answer
    Inspiring
    April 10, 2019

    Ok, I found a way to do it... using scenes and this same code to move the movie along the time line... If anyone can give me some opinion or more ideas about how to do it in a better way I would appreciate.

    Thank you all for your help

    ... and once again I'm sorry if the questions are really silly...

    Preran
    Legend
    April 12, 2019

    There's nothing like a silly question, we all keep learning through experiments. Thank you for posting on this forum, and for sharing your solution.

    Have a wonderful weekend.

    Preran