滑动手机触摸屏的手势

时间:2015-05-14 12:04:06

标签: android actionscript-3 frame gestures swipe-gesture

是否有人知道滑动的AS3代码并转到下一帧?我是Action Scripting的新手,我正在用一大堆不适合舞台的幻灯片做一些flash演示,

所以我更喜欢在每一帧上放置每张幻灯片,但我不知道它的代码是什么,它会产生与普通幻灯片相同的效果。

1 个答案:

答案 0 :(得分:0)

由于您没有提及“动画”“正常”幻灯片的内容或方式,我只能告诉您如何完成滑动:

        import flash.ui.Multitouch;
        import flash.ui.MultitouchInputMode;
        import flash.events.TransformGestureEvent;

        Multitouch.inputMode = MultitouchInputMode.GESTURE;
        stage.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);

        function onSwipe(e:TransformGestureEvent):void {
            if (e.offsetX >= 1) {
                //right swipe

                //check to make sure you're not on the last frame
                if(this.currentFrame < this.totalFrames){
                   this.nextFrame();
                }else {
                    this.gotoAndStop(1); //reset to first frame if you want
                }
            }else {
                //left swipe

                //check to make sure your not on the first frame
                if(this.currentFrame > 1){
                    this.prevFrame();
                }
            }
        }