在actionscript中,如果多个实例正在监听同一个事件,哪个先执行?
In actionscript, if multiple instances are listening for the same event, which executes first?
我有各种 类 的各种实例都在监听 ENTER_FRAME。我需要知道他们将按照什么顺序执行。
默认 事件侦听器根据添加它们的顺序执行:
Event listeners with the same priority are executed in the order that they were added, so the earlier a listener is added, the sooner it will be executed.
但您可以通过 priority
参数控制此顺序:
When you call addEventListener(), you can set the priority for that event listener by passing an integer value as the priority parameter. The default value is 0, but you can set it to negative or positive integer values. The higher the number, the sooner that event listener will be executed.
注意 broadcast events
,即附加到多个对象的 priority
参数 NOT跨多个对象影响事件顺序,仅影响附加到 相同 对象的侦听器中的顺序,因此执行顺序仍然由添加它们的顺序控制。
我有各种 类 的各种实例都在监听 ENTER_FRAME。我需要知道他们将按照什么顺序执行。
默认 事件侦听器根据添加它们的顺序执行:
Event listeners with the same priority are executed in the order that they were added, so the earlier a listener is added, the sooner it will be executed.
但您可以通过 priority
参数控制此顺序:
When you call addEventListener(), you can set the priority for that event listener by passing an integer value as the priority parameter. The default value is 0, but you can set it to negative or positive integer values. The higher the number, the sooner that event listener will be executed.
注意 broadcast events
,即附加到多个对象的 priority
参数 NOT跨多个对象影响事件顺序,仅影响附加到 相同 对象的侦听器中的顺序,因此执行顺序仍然由添加它们的顺序控制。