1 Reply Latest reply on Mar 24, 2011 11:34 AM by Flex harUI

    KEY_DOWN for 's' key is never dispatched while ctrl key is down

    Sree_D

      Hi,

       

           I am trying to implement save, cancel and undo using key combinations of ctrl+s, ctrl+r, ctrl+z but KEY_DOWN for 'c' key is never dispatched while ctrl key is down. Below is the code I am using to detect the key combinations but the char code or key code never changes if other keys are pressed when ctrl key is down. Let me know if there is a way to capture these combinations.

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"

      creationComplete="onComplete()"

      >

       

      <mx:Script>

      <![CDATA[

       

      public function onComplete():void

      {

       

      //this.addEventListener(KeyboardEvent.KEY_DOWN,onKeydown);

      }

       

      private function onKeydown(event:KeyboardEvent):void {

      t2.text = event.altKey +

      "/" +event.ctrlKey + "/" +event.keyCode + "/" + event.charCode;

      }

      ]]>

       

      </mx:Script>

       

       

      <mx:TextInput id="t1" width="600" height="200" keyDown="onKeydown(event)"/>

       

      <mx:TextInput id="t2" width="600" height="200" />

      </mx:Application>