2 Replies Latest reply on Jun 1, 2007 12:22 AM by rgujjarlapudi

    ctrl+key keyhandling broken?

    hermetic_comp
      Hi --

      I'm wondering if this is a known issue, or if I'm doing something wrong. I was attempting to intercept ctrl+char key sequences in a TextInput field (essentially, doing the same thing as the example on page 123 of 'Creating and Extending Flex 2 Components'). When the control key is held down however, the key codes are wrong.

      Below is the most simple example I can create. When you press the letter 'a' with the mx:TextInput in focus, an alert message pops up with the text: "keyDown; keycode=65; charCode=97", which seems perfectly reasonable and expected. When you press and hold control and then a however, an alert message pops up with the text: "keyDown; keycode=1; charCode=1" (and the event.ctrlKey boolean is set true, btw). Likewise, b --> "keyDown; keycode=66; charCode=98", ctrl-b --> "keyDown; keycode=2; charCode=2".

      I'm using Flex Version 2.0.1 build 155542 for the Mac, FlashPlayer 9,0,28,0. Safari is opening the SWF directly. I'm compiling with mxmlc on the command line.

      Does anyone know if this is a known issue? If anyone else has a moment to check this code on their system, do you also get wacky keyCode and charCode values when the control key is pressed?

      Thanks a lot!

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application
      xmlns:mx=" http://www.adobe.com/2006/mxml"
      layout="vertical">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      ]]>
      </mx:Script>

      <mx:TextInput
      keyDown='Alert.show("keyDown; keycode="+String(event.keyCode)+
      "; charCode="+String(event.charCode))'/>

      </mx:Application>