Skip to main content
Known Participant
November 1, 2021
Question

how to use swipe to next frame

  • November 1, 2021
  • 2 replies
  • 442 views

 

hi every one

 

please i need help with this i want to use (( swipe to next/previous frame) from action list F9

but i don't know how i added directly but when i test the project i got a blank page  

my idea is to swipe the project frame by frame in mobile by touch

 

 

Regards

    This topic has been closed for replies.

    2 replies

    JoãoCésar17023019
    Community Expert
    Community Expert
    November 7, 2021

    Hi.

     

    Here's a sample:

     

    AS3 code:

    import flash.events.TransformGestureEvent;
    import flash.ui.Multitouch;
    import flash.ui.MultitouchInputMode;
    import flash.events.MouseEvent;
    
    function swipeHandler(e:TransformGestureEvent):void
    {
    	switch(e.offsetX)
    	{
    		// swiped right
    		case 1:
    		{
    			prevFrame();
    			break;
    		}
    		// swiped left
    		case -1:
    		{
    			nextFrame();
    			break;
    		}
    	}
    }
    
    function playFrames(e:MouseEvent):void
    {
    	anim.gotoAndPlay(2);
    }
    
    stop();
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, swipeHandler);
    playFramesButton.addEventListener(MouseEvent.CLICK, playFrames);

     

    Please notice that you need the AIR emulator to test the swipe gesture or to run the app (.apk) in an actual device.

     

    For the button, you only need to send the timeline to the frame you wish using gotoAndPlay and place a stop method in the frame you wish to stop.

     

    FLA / source / files / SWF:

    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/as3/swipe_gesture

     

    I hope it helps.

     

    Regards,

    JC

     

     

    maryams87Author
    Known Participant
    November 1, 2021

    guys also i need to know how i can play specific frames and stop

     

    example i have  a button when i click it i need it to go to frame 1 and frame 2 then stop (( go and play 2 frames then stop in frame 2))

     

    thanks

    maryams87Author
    Known Participant
    November 6, 2021

    still no answers

     

    anyone can help me please