停在最后一帧(闪光灯) [英] stopping on the last frame (flash)

查看:20
本文介绍了停在最后一帧(闪光灯)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的影片剪辑播放一次并在最后一帧停止.我在我的影片剪辑类的循环中使用以下代码.(这是as3)

I want my movieclip to play once and stop on the last frame. I use the following code in the loop of my movieclip class. (this is as3)

if(currentFrame == 120)
stop();

120 是最后一帧.它播放一次.但问题是它又回到了第 1 帧.有没有更好的方法在特定帧上停止影片剪辑.

120 is the last frame. It plays once. but the problem is it goes back to frame 1 again. is there a better method of stopping a movieclip on a particular frame.

推荐答案

如果你想用 actionscript 来做,而不是手动添加 stop() 到时间轴的最后一帧,那么你可以使用未记录的 addFrameScript() 方法.

If you want to do it with actionscript and not add a stop() to the last frame on the timeline manually, then you can use the undocumented addFrameScript() method.

mc.addFrameScript(mc.totalFrames - 1, function():void 
{
    mc.stop();
});

不记得函数的作用域,但你可以使用 mc.stop(),或者只是 stop().

Can't remember the scope of the function, but you can either use mc.stop(), or just stop().

*EDIT - -1 添加到 addFrameScript 的第一个参数,因为它是从零开始的(所以要在 10 帧上放置一个 frameScript你会放9).

*EDIT - Added -1 to the first parameter of addFrameScript, because it is zero based (so to put a frameScript on frame 10 you would put 9).

这篇关于停在最后一帧(闪光灯)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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