[英]Swipe gesture for touchscreen of phone
Does anyone know the AS3
code for swipe and go to the next frame? 有人知道要刷卡的
AS3
代码并转到下一帧吗? I'm new to Action Scripting, I'm doing some flash presentation with a loads of slides that doesn't fit on the stage, 我是Action Script的新手,正在做一些Flash演示,其中载有舞台上不适合的幻灯片,
So i prefer to put each slide on each frame but i don't know what is the code for this that would animate the same effects as the normal slide does. 因此,我更喜欢将每张幻灯片放在每个帧上,但是我不知道用什么代码可以赋予与普通幻灯片相同的效果。
Since you don't mention what or how you "animate" the "normal" slide, all I can show you is how to accomplish the swiping: 由于您没有提及“正常”幻灯片的动画内容或方式,因此我只能向您展示如何完成滑动:
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.