I’m looking to recreate a keyboard shortcut quiz in flash much like this example that’s been done in javascript… (Note: the example seems to only really work well on Windows - I’m hoping mine proves to be more compatible?). a timer counts down while it waits for you to correctly perrform the shortcut on the keyboard.
I’ve successfully implemented a key combination listener such as is detailed in a tutorial here. I’ve gotten it to parse my list of shortcuts from a delimited txt file, correctly analyze user combination held & advance/score if correct, drive score based on countdown time remaining, manage “pass” to skip tough ones, etc.
You can see my progress here.
http://www.realitytheory.com/clients/amit/indexTest.html
However I’ve still got several things that don’t work even though I’m using fscommand(“trapallkeys”, “true”); (does that even matter when used within browser plugin?)
-
Ctrl key doesn’t register on Macs (tried Safari & Ffox) but Cmd key does. This is odd since it works fine when previewing in Flash via Ctrl-Enter (and having enable keyboard shortcuts disabled in that player). Not a showstopper as client’s cool if it’s windows only.
-
Any shortcuts that utilize the Alt key - seems flash doesn’t detect a key event when I hit that key. I’ve seen another thread here intimating that Flash can’t hear code #18 (alt) even though javascript can it certainly seems true in flash player. Is this true? Can it be somehow “pressed” by javascript via a JS key handler?
-
Any that conflict with browser default actions e.g. Ctrl-P, Ctrl-S. Before saying there’s no way, note that somehow the JS on the example link do block those (on IE/Ffox Win anyways). Does anyone have a clue what part? Will disabling the browser’s default actions mean Flash receives the input or will flash not hear them either?
Any help will I’m sure benefit anyone looking to listen for key combos.