1 Reply Latest reply on Dec 10, 2006 12:04 AM by jfillman

    Control Keyboard keys

    MahePya Level 1

      I want to control the keyboard function keys while flex application running on IE. I wrote the following coding,
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      import mx.controls.*;
      private function addListeners():void
      stage.addEventListener(KeyboardEvent.KEY_DOWN, trapKeys);

      private function trapKeys(e:KeyboardEvent):void
      if((e.keyCode==123) || (e.keyCode==120) || (e.keyCode==119) || (e.keyCode==118) || (e.keyCode==113) )
      Alert.show("Possible function keys");
      else if ((e.keyCode==122) || (e.keyCode==121) || (e.keyCode==117) || (e.keyCode==116) || (e.keyCode==115) || (e.keyCode==114) || (e.keyCode==112) )
      Alert.show("IE function keys");
      Alert.show("Normal keys");

      charcde.text = String(e.charCode);


      <mx:Label x="41" y="86" text="Enter key"/>
      <mx:Label x="41" y="129" text="Char Code"/>
      <mx:Label x="41" y="176" text="Key Code"/>
      <mx:TextInput id="my_input" keyUp="trapKeys(event)" x="113" y="84"/>
      <mx:TextInput x="113" y="131" id="charcde" />
      <mx:TextInput x="113" y="176" id="keycde"/>

      -- While running this program , when press F2 the "Possible function keys" alert message opened perfectly. But when will I press F1 , F3 , F4 , F5 , F6 , F10 , F11 the "IE function keys" alert message is not open. How can i control this.

      Thanks in Advance,