8/23/2010 7:50:41 AM
Title:
Key Pressed
How can I check in AIR whether "ctrl+ a key " is pressed.
Thankyou.
Tyler
Points: 430
Posts:0
8/23/2010 8:36:16 AM
see this source code and example in flex with actionscript 3 to detect the ctrl key press and "a" keypress combination
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="appcomplete()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function appcomplete():void
{
this.setFocus();
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
}
private function keyDown(e:KeyboardEvent):void
{
if(e.ctrlKey && e.keyCode == 65)
{
Alert.show("ctrl+a pressed ");
}
}
]]>
</mx:Script>
</mx:Application>
8/23/2010 9:14:46 AM
Thankyou for the answer
what is the difference between e.ctrlKey and e.controlKey?
Can u explain.