open air application by window hotkeys
I am developing flex air application.I have to implement hot-key functionality in air application.
For example whenever user press any two keys like ctr and S keys the open flex air application. 开发者_如何学JAVAand whenever user press any two keys like ctr and q keys then close flex air application.
Is it possible in flex?
Thanks
It's not possible for a not-running program to intercept key commands. As such you cannot tell the application to start on some key command; either the program needs to run already, or you need to set that key command to the OS (you can do that in Windows in the properties panel for example).
The other command is rather easy, just listen for KeyDown events and check if your combination was pressed; and if so, quit the application.
Not to my knowledge.
For this kind of functionality you need a daemon or a background process. Because in AIR it's not possible to listen for keys when not focused (alias key logger) it would have to be a native application (different versions for different OS).
An alternative would be to somehow set a key stroke in the OS configuration - but then again, this is very different on different OS, and it is not supported by AIR - a native process would be required, too.
If you want to make this simple, it's not possible, unless you really want to invest a lot of time to write these processes, one for each different OS.
精彩评论