I am looking for a solution in Flex where I can capture a combination of keyboard inputs such as: [CTRL] + A + B
That is, pressing the CTRL key and the user presses two keys (instead of the usual one).
I can capture the event when somebody keys: [CTRL] + A with the following code:
if (event.ctrlKey && event.keyCode == 65)
How would I capture an additional key so that the event is captured when somebody presses CTRL, A and B?
You will need to listen to KEY_DOWN as well as KEY_UP, and use these to set an internal flag denoting whether A or B is currently pressed. – let’s call it
a_isDown:booleanandb_isDown:boolean.Then, in your
KEY_DOWNevent,