我如何知道 MovieClip 何时放置在舞台上完成播放?
MovieClip(mcName).play();
MovieClip(mcName).addEventListener(??????, myStopFunction);
或者你对比赛结束的了解有何不同?
MovieClip 是一个外部文件,根据需要加载到 swf 中。
MovieClip(mcName).play();
MovieClip(mcName).addEventListener(??????, myStopFunction);
Or how differently you can learn about the end of play?
MovieClip is an external file and loaded into the swf as needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用所有 MovieClip 都具有的两个属性:
totalFrames - currentFrame
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html#currentFrame
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html#totalFrames
Use two properties all MovieClips have:
totalFrames - currentFrame
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html#currentFrame
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html#totalFrames
当我有自定义动画并想知道何时完成时,我会从动画的最后一帧调度自定义事件。通常一个 Event.COMPLETE 就可以了。
在 myAnimation MovieClip 的最后一帧中,我执行以下操作:
然后在主代码中,我监听将侦听器添加到该 evnet:
When I have a custom animation and want to know when finishes I use to dispatch a custom event from the last frame of the animation. Usually an Event.COMPLETE will do.
In the last frame of the myAnimation MovieClip I do:
Then in the main code I listen add listener to that evnet:
几乎像 @daniel.sedlacek 答案,但没有时间线代码:
Almost like @daniel.sedlacek answer, but without timeline code :
对于具有多个场景的 MovieClip,仅检查
currentFrame
和totalFrames
是不够的。您还必须检查它是否在最后一个场景。Only check
currentFrame
andtotalFrames
is not enough for a MovieClip that has multiple scenes. You must also check if it is at the last scene.