-
Website
http://www.abdulqabiz.com/blog/ -
Original page
http://www.abdulqabiz.com/blog/archives/2005/04/06/keyboard-shortcuts-for-flex-ui-components/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
melanie12345
1 comment · 1 points
-
kanti
1 comment · 1 points
-
anuradhashinde2001
2 comments · 2 points
-
joeboxer
1 comment · 1 points
-
petkusj
2 comments · 1 points
-
-
Popular Threads
I would like the above code ("Ctrl+1") (Keyboard shortcuts for Flex UI components) to make it work on Flex2.0 too. Since Flex2.0 doesn't have mx.utils.Delegate. Is there any alternate solutions for the above code?
Regards,
Ravi.G
I'm trying to do smth like this but it doesn't work in IE that takes precedences..would somebody help me to resolve this problem...?
private function init():void{
//your init code
this.addEventListener(KeyboardEvent.KEY_DOWN,keyHandler);
}
private function keyHandler(event:KeyboardEvent):void {
var bCTRLPressed:Boolean = event.ctrlKey;
if( bCTRLPressed){
var curKeyCode:int = event.keyCode;
if(curKeyCode==83){
//CTRL + S pressed; saveCall()
}
if(curKeyCode==78 ){
//CTRL + N pressed; NewEntryCall()
}
if(curKeyCode == 68){
//CTRL + D pressed; DeleteEntryCall()
}
if(curKeyCode == 67){
//CTRL + C pressed; CopyCall()
}
if(curKeyCode == 70){
//CTRL + F pressed; SearchCall()
}
}
}
.
.
var bCTRLPressed:Boolean = event.ctrlKey;
if( bCTRLPressed){
var curKeyCode:int = event.keyCode;
if(curKeyCode==83){
//CTRL + S pressed; saveCall()
}
.
.
You could just use the following:
private function keyHandler(event:KeyboardEvent):void {
var curKeyCode:int = event.keyCode;
if(curKeyCode==14){
//CTRL + N pressed;
}
.
.
No need to check if CTRL is pressed, unless you really need to react on a CTRL keypress alone.
CTRL + [x] does have its own keyCode, ex:
CTRL + A = 1
CTRL + B = 2
CTRL + C = 3
---
ALT + A = 197
ALT + B = 166
ALT + C = 199
---
A = 65
B = 66
C = 67
Happy coding...
I use the script of zied and work correctly