I'm doing SWF application which will run in browser.
And I want to capture CTRL+F
key pressing event when Flex application is in focus.
In Firefox it works fine but in Opera and Safari browser captures event prior to Flex application and Find Dialog pop-ups.
Is there any way for flex application to capture CTRL+F
event prior browser?
Take the Screenshot by using the Windows + Shift + S keyboard shortcut. If you're using Windows 10, press Windows + Shift + S at the same time to capture a portion of your screen and copy it to your clipboard.
Firefox ScreenshotsRight-clickHold down the control key while you click on an empty part of the page and select Take Screenshot. Alternatively, use the keyboard shortcut Ctrl + Shift + S .
I asked this same question recently and have been playing around with it.
I came up with this gist on github:
Browser KeyboardEvent Hijacking with Javascript and Flex
CTRL-F works!
Check out the javascript in there. Basically, with Safari, you can only hear the meta keys (ctrl/alt/shift, etc.); it won't allow javascript to hear A-Z events if Flash is running for some reason. So I just listen for the meta keys in javascript, and then call window.focus()
in javascript. That sets focus to the browser, making it so you can hijack browser keyboard events!. Then I listen for the A-Z events or whatever, and pass those to Flex.
The next step is to just restore focus in your Flex app to wherever it was before that, which should be easy.
Cheers, Lance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With