Hi Justin, the same problem persists if you for example have key combos with multiple keys and then suddenly change the focus to another application on your desktop (for example with Alt+Tab).
There is not fix for that, it is a problem related to the Flash Player from my point of view. You simply can't rely on getting all keyUpEvents 100%. You can however possibly workaround that if you concentrate on the keydown events only. For example you implement a listener for onkeydown events and then add a listener for xxx milliseconds listening if another keydown was called in that period. If yes, you can trigger your key-combo-event, if no you just clear the keyDownArray. That way you don't need any keyUpEvent at all. Sebastian 2012/6/8 Justin Ellis <[email protected]> > Hi all, > > Somewhat related to my last, invalid question since I am trying to > make a grid recognize shift+key combos. The problem is that, when I > catch an onkeydown event in my grid and check to see if the shift key > is down using "lz.Keys.isKeyDown('shift')", the first time I try it > with the shift key down the "isKeyDown" method returns "false," and > then only returns "true" if I keep the shift key down and enter in > subsequent key presses. To test, I added an "onkeydown" handler in my > canvas that looks like this: > > <handler name="onkeydown" reference="lz.Keys" args="kc"> > Debug.write("Key: " + kc); > </handler> > > Here is what happens: > > <I press the "Shift" key> - Nothing happens > <I release the "Shift key> - Debug Message: "Key: 16" > <I press the "Shift" key> - Nothing happens > <I press the "Down Arrow" key> - Debug Message: "Key 40", Debug > Message: "Key 16" > <I release and then press the "Down Arrow" key again> - Debug Message: > "Key 40" > > So basically the lz.Keys object does not register when "Shift" is > pressed until either (a) "Shift" is lifted, or (b) Another key is > pressed, at which time it registers the "Shift" press *after* the > other key is pressed, so a handler catching that key press will return > false for "lz.Keys.isKeyDown('shift')". > > Is there any way to fix this? > > -- > Justin Ellis > 646-783-9387 > Fax: 866-448-6503 > [email protected] > www.LightBulbLaw.com > -- Sebastian Wagner https://twitter.com/#!/dead_lock http://www.openmeetings.de http://www.webbase-design.de http://www.wagner-sebastian.com [email protected]
