闪光事件侦听器的全球性活动 [英] flash event listener for global events
问题描述
我有一系列的影片剪辑,一些影片剪辑内举行,即派遣一个自定义的移动事件,我想在舞台监听和互动的。有没有一种方法来添加到舞台(或任何对象)的事件侦听器的一种类型无论如何,不管它是从派出的?
I have a series of MovieClips, held within several MovieClips, that dispatch a custom move event that I would like the stage to listen for and interact with. Is there a way to add to the stage (or any Object) an event listener for any event of one type, regardless of where it was dispatched from?
例如,可能我添加到舞台事件侦听器来侦听任何引发Event.COMPLETE
这是从一个孩子的任何其子出动,或,或任何它是孩子的孩子?
For instance, could I add to the stage an event listener to listen for any EVENT.COMPLETE
that was dispatched from a child, or any of its children, or any of it's children's children?
推荐答案
您要找的是事件冒泡。新事件的第三个属性设置为true,使气泡,它会冒泡显示列表,从调度事件到舞台上的对象开始。看到官方文档获取更多信息。
What you are looking for is event bubbling. Set the third property of a new event to true to enable bubbling, and it will bubble up the display list, starting from the object dispatching the event to the stage. See the official docs for more info.
泰勒。
编辑:更改为从舞台出发,对象调度事件
Edited: Change "starting from the stage" to "object dispatching the event"
这篇关于闪光事件侦听器的全球性活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!