Actionscript 3.0:如何创建快进按钮而不跳过在特定帧上写的任何代码?

问题描述 投票:-1回答:1

我做了3层。

1层如下:我创建了fastForward和fastPrevious按钮使用

**

> function whatever()
{
 frame=currentFrame+90;
this.gotoAndPlay(frame);

}
**

我在第1层的开头写下了这段代码。

第2层如下:

stop();

我在中间框架的某处写下了这段代码。

第3层如下:仅第3层的按钮。

此代码使动画跳转/下一帧减少90帧,但它也会跳过在这些跳转/下一跳之间写入的代码(在第2层中)。如果我在第120帧或其他地方编写了一些代码,那么它会跳过该代码并在单击btnfastForward时跳转到下一个指定的帧。只想制作一些免费的fastForward和之前的按钮。

actionscript-3 flash jquery-animate flash-cs6 animate-cc
1个回答
0
投票

很简单。你只需要浏览它们之间的所有帧。

function fastForward(targetFrame:int, mustPlay:Boolean = true):void
{
    // Go to designated frame without skipping any.
    while (currenFrame < targetFrame)
    {
        nextFrame();
    }

    // The "nextFrame" method also performs "stop".
    // Resume playback if needed.
    if (mustPlay)
    {
        play();
    }
    else
    {
        stop();
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.