开发者

AS3 capture keypress regardless of the current focus?

开发者 https://www.devze.com 2023-03-06 06:57 出处:网络
When I add a keypress event listener to the stage, it does not fire when the focus is on another object. How can I listen for any keypress event regardless of the focus?

When I add a keypress event listener to the stage, it does not fire when the focus is on another object. How can I listen for any keypress event regardless of the focus?

Just setting the useCapture parameter to true does not work . I think it's because no event is bubbled up if I do not add a listener to every object on the stage.

Do I really have to add an eventlist开发者_运维问答ener to every object to capture a keypress event regardless of the current focused object?


I think if you add your keyEventListener to the stage and then in functions where the focus is changed add the code:

stage.focus = stage

it might work.

0

精彩评论

暂无评论...
验证码 换一张
取 消