It seems impossible to capture a keyboard event, usually used for copying when a Flex application is launched in a browser or as an AIR application, presumably because the browser or OS intercepts it in the first place.
Is there a way to tell the browser or OS to have the event pass?
For example, in AdvancedDataGrid, I set the keyUp event for handleCaseListKeyUp (event), which calls the following function:
private function handleCaseListKeyUp(event:KeyboardEvent):void
{
var char:String = String.fromCharCode(event.charCode).toUpperCase();
if (event.ctrlKey && char == "C")
{
trace("Ctrl-C");
copyCasesToClipboard();
return;
}
if (!event.ctrlKey && char == "C")
{
trace("C");
copyCasesToClipboard();
return;
}
trace("charCode: " + event.charCode);
trace("char: " + char);
trace("keyCode: " + event.keyCode);
trace("ctrlKey: " + event.ctrlKey);
trace("altKey: " + event.altKey);
trace("shiftKey: " + event.shiftKey);
}
At startup, I can never get the release of the "C" key, and also by pressing the command key (which appears as KeyboardEvent.ctrlKey). I get the following trace results:
charCode: 0
char:
keyCode: 17
ctrlKey: false
altKey: false
shiftKey: false
, , , , "C" .
- ?
"C" ( ) ?
?