To intercept the above key presses you need to register an event handler (possibly in an init function or any onCreation event) like this:
stage.addEventListener(KeyboardEvent.KEY_DOWN, mainWindow_keyDownHandler);
The function looks as follows:
protected function mainWindow_keyDownHandler(event:KeyboardEvent):void
{
if (event.ctrlKey && event.charCode == 114)//ctrl+r
{
button2_clickHandler(null); //refresh
}
if (event.ctrlKey && event.charCode == 102) { //ctrl+f
button3_clickHandler(null); //custom filter
}
if (event.ctrlKey && event.shiftKey && event.charCode == 70) { //ctrl+F
button1_clickHandler(null); //full screen
}
}
This method doesn't work (for example on my IE 9.0.8112).
ReplyDeleteWhen I add keyboard listener on addedToStage event, then press ctrl+r -> my flex app reloads...
PS: on creationComplete event, stage object doesn't created (stage == null)
PPS: sorry for my english - i'm learning it at this time :)