是否可以在 Actionscript 2.0 中访问框架的 NAME 属性?

发布于 2024-09-06 20:30:53 字数 215 浏览 8 评论 0原文

我将帧 50 命名为 _foo (在 IDE 中)。

我可以随时跟踪 this._currentFrame (并获取一个数字)。

我可以gotoAndPlay("_foo");

但是我怎样才能知道电影播放时当前帧是否是 _foo 呢?

这可能吗?

I name frame 50 _foo (in the IDE).

I can trace this._currentFrame at any time (and get a number).

I can gotoAndPlay("_foo");.

But how can I find out if the current frame IS _foo as the movie plays?

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给我一枪 2024-09-13 20:30:53

在 ActionScript 2 中,无法访问当前帧的名称/标签(此功能是在 ActionScript 3 中添加的)。

但是,您可以使用以下代码来确定播放期间的当前帧编号:

// This is the frame number we want to look out for.
var targetFrame : Number = 50;

// Crate an onEnterFrame function callback, this will be
// called each time the current MovieClip changes from one
// frame to the Next.
onEnterFrame = onEnterFrameHandler;

/**
 * This function is called each time the MovieClip enter a 
 * new frame during playback.
 */
function onEnterFrameHandler() : Void
{
    trace("_currentframe: " + _currentframe);
    if (_currentframe == targetFrame)
    {
        trace("Playhead is at Frame: " + _currentframe);

        // Stop playback and remove the onEnterFrame callback.
        stop();
        onEnterFrame = null;
    }
}

要进一步阅读,请务必检查 Adob​​e livedocs 条目中的 MovieClip.onEnterFrame

In ActionScript 2 there is no way to access the Name / Label of the current frame (this feature was added in ActionScript 3).

However, you could use the following code to determine the current frame number at during playback:

// This is the frame number we want to look out for.
var targetFrame : Number = 50;

// Crate an onEnterFrame function callback, this will be
// called each time the current MovieClip changes from one
// frame to the Next.
onEnterFrame = onEnterFrameHandler;

/**
 * This function is called each time the MovieClip enter a 
 * new frame during playback.
 */
function onEnterFrameHandler() : Void
{
    trace("_currentframe: " + _currentframe);
    if (_currentframe == targetFrame)
    {
        trace("Playhead is at Frame: " + _currentframe);

        // Stop playback and remove the onEnterFrame callback.
        stop();
        onEnterFrame = null;
    }
}

For further reading, be sure to check the Adobe livedocs entry for MovieClip.onEnterFrame

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文