프로그래머의 삶 Programmer's Life/Flex3.0

단축키 예제...단...단축키만 먹지..내부 링크는 안된다.ㅡㅡ

Oliver's World 2008. 11. 3. 17:46
728x90
<?xml version="1.0" ENCODING="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="14"
 initialize="initShortKey()">
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   private function initShortKey():void{
    application.addEventListener(KeyboardEvent.KEY_DOWN,keyHandler);
    ta.setFocus();
   }
   private function keyHandler(event:KeyboardEvent):void{
    if(event.ctrlKey){
     var curKeyCode:int=event.keyCode;
      var urlRQ:URLRequest=new URLRequest();
      if(curKeyCode==65||curKeyCode==97){
       urlRQ.url=="http://www.naver.com";
       navigateToURL(urlRQ,"_new");
      }else if(curKeyCode==66 || curKeyCode==98){
       urlRQ.url=="http://www.daum.net";
       navigateToURL(urlRQ,"_new");
      }
    }
   }
  ]]>
 </mx:Script>
 <mx:Panel title="test" width="575" layout="absolute" height="471" x="37" y="24">
  <mx:Button x="97" y="22" label="컨트롤+a  네이버"   cornerRadius="0" width="360"/>
  <mx:Button x="97" y="63" label="컨트롤+B  다음"  cornerRadius="0"  width="360"/>
 <mx:ControlBar>
 </mx:ControlBar>
 </mx:Panel> 
 <mx:TextArea id="ta" x="0" y="0" width="100%" height="100%" alpha="0" visible="false"/>
</mx:Application>
728x90