将影片剪辑数组添加到过滤器 ActionScript 3
我将 8 个 mc 存储在一个数组中,然后将它们放在舞台上。 现在我想对这些MC应用模糊效果。 我的问题是我不知道如何通过单击来为每个 mc 应用模糊效果。 例如,我在舞台上拥有所有MC,如果我单击其中之一,则被单击的MC应该具有模糊效果等等。 如何将过滤器应用到MC上? 谢谢你的时间
i stored 8 mc's in an array an i put them on the stage.
now I want to apply to these mc's a blur effect.
My problem is that i don't know how to apply for every mc the blur effect by clicking on it.
So for example I have all the mc's on the stage and if I click on one of them the clicked one should have the blur effect and so on.
How to apply the filter to the mc's?
Thank you for you time
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以循环遍历 mc 的数组并在每个 mc 上添加事件侦听器:
以及事件处理程序:
当然,如果您一次只想有一个模糊的 mc,则应该保留对它的引用,并在另一个 mc 时删除模糊被点击:
You can loop through the mc's array and add event listeners on each of them:
and the event handler:
of course, if you wanted to have only one blurred mc at a time, you should keep a reference to it and remove blur once another mc is clicked:
像这样的东西(未经测试)应该可以工作:
只需将数组传递给该类的新实例
并在完成后进行清理:
因为它们都是影片剪辑,所以您应该使用 Vector 而不是 Array。
something like this (untested) should work:
just pass your array to a new instance of the class
and clean up when your done:
since they're all Movie Clips, you should use a Vector instead of an Array.