4 Replies Latest reply on Mar 18, 2017 10:51 AM by Silly-V

    Key press capturing not working

    pencilking2002

      Hi. I'm trying to capture some key presses but nothing seems to happen. Here's my code:

       #target illustrator
      
      var palette = new Window("palette", "Animation Settings");
      var playButton = palette.add("button", undefined, "Play");
          playButton.addEventListener("keydown", function (kd) {
                 testKeyPress(kd);
          });
      
      
      
      
       function testKeyPress(k)
      {
           $.writeln(k.keyName);
       }
      palette.show();
      

       

      Any ideas as to why that doesn't work? I thought you could attach a keypress listener to any UI object? Attaching it to the palette doesn't work either. I'm targeting illustrator CS6