繁体   English   中英

滑动手势可用于手机的触摸屏

[英]Swipe gesture for touchscreen of phone

有人知道要刷卡的AS3代码并转到下一帧吗? 我是Action Script的新手,正在做一些Flash演示,其中载有舞台上不适合的幻灯片,

因此,我更喜欢将每张幻灯片放在每个帧上,但是我不知道用什么代码可以赋予与普通幻灯片相同的效果。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM