Actionscript 3.0 MovieClip 帧更改侦听器
我有一个与怪物的场景。怪物眨着眼睛。眨眼是一个单独的MovieClip。 在某些条件下,怪物会张开嘴。张嘴也是一个单独的影片剪辑。此时此刻我不得不闭上眼睛MovieClip。一旦怪物闭上嘴,我就必须让眨眼的眼睛再次可见。
我的想法是让一些听众听 Mouth_opening MovieClip。当嘴巴张开的currentFrame从1变成2时,我会隐藏眼睛。当它从 2 变为 1 时,我会将其显示回来。
那么,问题是:如何监听 currentFrame 的变化? Event.ENTER_FRAME 不合适:它在每个渲染帧都被调用,而不仅仅是在 currentFrame 更改时调用。
I have a scene with a monster. Monster blinks its eyes. Eyes blinking is a separate MovieClip.
Under some conditions, monster opens its mouth. Mouth opening is a separate MovieClip as well. At this moment I have to hide eyes MovieClip. As soon as monster closes its mouth, I must make eyes blinking visible again.
My idea is to have some listener that listens to Mouth_opening MovieClip. When Mouth opening's currentFrame changes from 1 to 2, I will hide eyes. When it changes from 2 to 1, I will show it back.
So, the question is: how do I listen to currentFrame changes?
Event.ENTER_FRAME is not appropriate: it's being called every render frame, not only when currentFrame changes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ActionScript 中没有“frameChange”事件,因此您需要制定自己的系统。例如,您可以通过监听
enterFrame
来使其工作,然后监视当前帧 - 当它更改时调用您的函数。类似的东西应该有效:There is no "frameChange" event in ActionScript so you need to come up with your own system. For example, you can make it work by listening to
enterFrame
then monitor the current frame - when it changes call your function. Something like that should work: