我将第 50 帧命名为_foo
(在 IDE 中)。
我可以随时追踪this._currentFrame
(并得到一个号码)。
我可以gotoAndPlay("_foo");
。
但是我怎样才能知道当前帧是否是_foo
电影播放的呢?
这可能吗?
我将第 50 帧命名为_foo
(在 IDE 中)。
我可以随时追踪this._currentFrame
(并得到一个号码)。
我可以gotoAndPlay("_foo");
。
但是我怎样才能知道当前帧是否是_foo
电影播放的呢?
这可能吗?
在 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;
}
}
如需进一步阅读,请务必查看 Adobe livedocs 条目中的MovieClip.onEnterFrame