flash cs5:当我更改影片剪辑中的帧时,指向前一帧中一个对象的事件侦听器将被删除

发布于 2024-09-28 17:16:07 字数 240 浏览 3 评论 0原文

我有一个包含两个帧的影片剪辑,每个帧包含一组不同的按钮。

看来我无法将事件侦听器添加到不在我当前查看的框架中的按钮。

所以..问题一:有没有办法向影片剪辑中的所有元素添加事件侦听器,即使这些元素位于不同的帧中。

问题二:在我向当前帧中的某些元素添加事件侦听器然后前进到下一帧并返回到同一帧后,所有事件侦听器都被删除,我需要再次初始化它们。有没有办法解决问题而不需要重新初始化事件侦听器?

感谢您的帮助!

I have a movieclip that contains two frames, each frame contains a different set of buttons.

it seems that i cannot add the event listeners to buttons that are not in my current viewed frame.

so.. problem one: is there a way to add event listeners to all the elements in the movieclip even if the elements are in a different frame.

problem two: after I added an event listener to some elements in current frame and then I move forward to the next frame and go back to the same frame, all the event listeners are removed and i need to initialize them again. is there a way to resolve the issue without the need to re-initialize the event listeners ?

thank you for your help!

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

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

发布评论

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

评论(1

守护在此方 2024-10-05 17:16:07

我不这么认为,但是..

我解决这个问题的方法非常简单。我将事件侦听器初始化代码放在时间轴中,特别是放在包含调度事件的元素的帧上。

它解决了你的两个问题。仅当您位于该特定帧上时,侦听器才会处于活动状态。

I don't think so, but..

The way I worked around this problem was pretty simple. I put the event listener intializing code in the timeline, specifically on the frame that contains the element that dispatches the event.

It solves both of your problems. The listeners will only be active, when you're on that specific frame.

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