3 Replies Latest reply on Apr 10, 2014 3:04 PM by Flex harUI

    Ctrl + c keyboard event for a data grid not working - Action script 2.0

    RajaSekhar

      I'm using Macromedia Flex 1.5 with AS 2.0, I want to keep ctrl + c keyboard event for a datagrid,

      I'm trying following code, but it's not working. What am I doing wrong?

       

       

      <mx:Script>

      <![CDATA[

                          function myOnKeyDown()

                           {

       

       

       

       

                               if (Key.isDown (Key.CONTROL) && Key.isDown(67))

                                 {  

                                 mx.controls.Alert.show("Copied Succesfully: ");

                                 }

                               else

                                 {

                                   mx.controls.Alert.show("Press control + c to copy: ");

                                 }

                           }

       

       

      ]]>

      </mx:Script>

       

       

      <mx:DataGrid width="100%" height="35%" id="cur1_DataGrid" sortableColumns="false" change="level1var.checkForChanges()" keyDown="myOnKeyDown()">

       

       

       

       

      Actually, if(Key.isDown(67)) is working fine and if(Key.isDown(Key.CONTROL)) also working fine when they are given individually.

       

       

      but (Key.isDown(Key.CONTROL) && Key.isDown(67)) is not working.