7 Replies Latest reply on Feb 2, 2012 1:30 PM by berlinnewmedia

    HELP!!! Using event listener to trigger Text

    berlinnewmedia

      I am using the following code to create the quick word for a translator who is doing a live translation of a chat.

       

      keyListener = new Object();

      keyListener.onKeyDown = function(){

          if(Key.isDown(Key.CONTROL)){

              if(Key.isDown(51)){

                  txt.text = "Sarah says:";

              }

          }

      }

      Key.addListener(keyListener);

       

       

      keyListener = new Object();

      keyListener.onKeyDown = function(){

          if(Key.isDown(Key.CONTROL)){

              if(Key.isDown(51)){

                  txt.text = "Client says:";

              }

          }

      }

      Key.addListener(keyListener);

       

      the word is succesfully generated, only problem is, it deletes all the other text in the text box as well. Is there a way of making a keyboard shortcut which just adds that text on the same row I am on?

      Otherwise I am also happy to settle for a button which generates this text as long as it does not delete the other text in the text box. any replies would be greatfully appreciated.

       

      Thanks