header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Kane
Points:0
Posts:0

8/23/2010 7:50:41 AM

Title: Key Pressed


How can I check in AIR whether "ctrl+ a key " is pressed.
Thankyou.



1
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>


2
Kane
Points: 0
Posts:0
8/23/2010 9:14:46 AM



Thankyou for the answer
what is the difference between e.ctrlKey and e.controlKey?
Can u explain.


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions