Ctrl+T or Ctrl+N in Flex
Line Break
Author: Arjan (36 Articles) - Author Website
Arjan is a SAP Consultant specialized in ABAP and Front End development techniques like Web Dynpro, Adobe Interactive Forms, Flex and AIR. In his free time he likes to create examples for Flex-Blog and other applications using Flex, AIR and PHP. Other hobbies are movies and music. He is also the co-owner of Flex-Blog.com.
A while ago I had an issue. While I had some Flex application running in a browser tab, ctrl+t (open new tab) and (ctrl+n) were not working. I implemented a simple solution to solve this problem.
Do the following:
- Add a keyDown event listener to your Application
- Implement the listener to do something when the keys are ctrl+t / ctrl+n
Step 1:
1 2 | <mx:Application keyDown="handleKeypress(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> |
Step 2:
1 2 3 4 5 6 7 8 9 | private function handleKeypress(event:KeyboardEvent):void { if(event.ctrlKey && event.keyCode == 84){ var request:URLRequest = new URLRequest("http://www.google.com"); navigateToURL(request); } } |
event.ctrlKey is true when the ctrl key is hold while pressing the key (event.keyCode 84 is the “t” in this case).
So when the user presses ctrl+t, a navigateToURL is called going to the specified URL, www.google.com in this case. Simple, but very useful.
Related posts:
Comments
One Response to “Ctrl+T or Ctrl+N in Flex”


(
nice share, very helpful..
Thanks..