闪存AS3 | code执行前完成当前的动画集 [英] Flash AS3 | Finishing current animation set before code is executed

查看:123
本文介绍了闪存AS3 | code执行前完成当前的动画集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解决有关键的使用方法有问题我已经在Flash AS3 CC。我会尽力,使这是很容易解释,因为我可以。

I'm trying to solve a problem I have in Flash CC AS3 regarding button usage. I'll try and make this as easy to explain as I can.

我现在有两套帧有运动在他们:一个人的一个缓缓走来(帧1-30),其次是同一个人,但走路快得多(帧31-60)。在这两套动画,开始和结束帧是完全一样的,所以无缝转换可以如果过渡发生在当前观看动画的结束点被激活。

I currently have two sets of frames that have motion in them: one of a man walking slowly (frames 1-30) and the next is the same man but walking much faster (frames 31-60). For both sets of animations, the start and end frames are exactly the same, so a seamless transition can be enabled if the transition happens at the end point of the currently viewed animation.

该工作组由自己通过简单地从他们的起始帧,直到结束帧,其中AS code,使他们停下来,然后跳回到原来的出发点和重复,在无限循环播放。我有一个按钮,按下时,跳转到下一个动画,其中的新动画开始播放,的起点。 EG的男人走,我preSS的按钮,现在的人是走快。

The sets work by themselves by simply playing from their start frame till the end frame, where AS code makes them stop and then jump back to the original start point and repeat, on endless loop. I have a button that, when pushed, jumps to the start point of the next animation, where the new animation is now played. EG the man is walking, I press the button, now the man is walking faster.

问题是,当我按下按钮,动画立即从任何框架的是当前新的起点改变了,这就形成了腰斩的效果,看起来可怕,因为跳过的帧。我怎么就能够让这个当按下按钮,其余帧完成跳跃到新的动画之前玩? IE浏览器的人是在第17帧中端走,并在用户按下按钮。在动画播放出到第30帧跳过打新循环的第31帧之前。

The problem is that when I push the button, the animation instantly changes from whatever frame you are currently on to the new start point, and this creates a 'cut' effect which looks awful because of the skipped frames. How would I be able to make it so that when the button is pushed, the remaining frames finish playing before jumping to the new animation? IE The man is mid walk at the 17th frame, and the user pushes the button. The animation plays out to the 30th frame before jumping over to play the 31st frame of the new loop.

我已经试过玩弄周围的if语句,但我无法找到正确的命令来解决这个问题。任何帮助将是非常美联社preciated

I've tried toying around with an if statement, but I can't find the proper commands to solve this issue. Any help would be much appreciated

TL; DR 一旦解决,动画应履行如下:帧1-30扮演一个无缝循环。当我preSS按钮,动画将继续发挥,直到第30帧,在那里将开始在循环播放帧数31-60。

TL;DR Once resolved, the animation should perform as follows: Frames 1-30 are playing in a seamless loop. When I press a button, the animation will continue to play until Frame 30, where it will then begin to play Frames 31-60 in a loop.

任何帮助将是非常美联社preciated!

Any help would be much appreciated!

推荐答案

本尼斯和简单的答案:),你可以使用一个事件侦听器来检查当前帧帧30,一旦被点击的按钮。你可以使用if语句,此检查。

Nice and simple answer for this :) you could use an event listener to check if the current frame is frame 30 once the button is clicked. You could use an if statement for this check.

在单击该按钮添加监听器:

When the button is clicked add this listener:

addEventListener(Event.ENTER_FRAME, enterFrame);

和再检查使用这样的:

function enterFrame(e:Event):void {
    if (someAnimation.currentFrame == 30) {
        //do this
    }
}

有一个快速的注意,我在我的iPhone因此不能检查,如果这个工程,虽然它很可能。

A quick note that I'm on my iPhone so cannot check if this works although it's likely to.

这篇关于闪存AS3 | code执行前完成当前的动画集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆