Ctrl up and down sensing
Hi
I want to set a public var to true when ctrl of shift are pressed, and then false when they are not pressed. This is to tie in with some datagrid functions that react differntly when Ctrl or shift are down.
onKeyBoardDown() is sussessfully tracing when the keys are down, but onKeyboardUp is not when they are released. Why is that? THANKS!
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyBoardUp);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyBoardDown);
private function onKeyBoardDown(event:KeyboardEvent):void
{
if ( event.ctrlKey ) //if control key is down
{
trace ('CTRL on');
}
else if ( event.shiftKey )
{
trace ('SHIFT on');
}
else
{
trace('NONE!!!');
}
}
private function onKeyBoardUp(event:KeyboardEvent):void
{
if ( event.ctrlKey ) //if control key is up
{
trace ('CTRL off');
}
else if ( event.shiftKey )
{
trace ('SHIFT off');
}
}
