简体   繁体   中英

Flex capture all mouse clicks on application

I want to capture every mouse event and I tried to add event listeners to FlexGlobals.topLevelApplication. However there are some cases (like Flex's Menu class) when the clicks aren't captured - probably somewhere the event propagation is stopped. For example in SystemManager.as I found this:

 addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, true, 1000);

...which seems to override my listener. Also I tried to add Listeners with priority int.MAX_VALUE but with no success.

So my question is - how can I capture all mouse clicks, without worrying about my events being stopped somewhere? Maybe some javascript hack? Or maybe to add the event listeners somewhere where there is no chance for them to be canceled? Thanks.

您可以尝试将事件处理程序添加到具有捕获的阶段:

systemManager.stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, true, Integer.MAX_VALUE);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM