3 Replies Latest reply on Feb 3, 2014 1:57 AM by moccamaximum

    print keystroke


      Hello. i wants to know how to print Keystroke diractly from flash by pressing on a button. Like i wants that button to excute a word just like i would write by my keyboard. and hit enter.


      there is this game that we are allowed to make flash widget on it. and i have so many ideas of using a flash widget on it. one of them, is i wants to be able to excute a word. which it is command that we write it on that game. but i wants instate of write it. i wants to excute a punch of commands by XML file.  or at least. to excute a custome word "command" how can i do that?


      can anyone tell me how to do that? or where i should look at to understand how this script can be made? or what the code that is used. or function or what ever lol. sorry im Sooooooooooooooo begginer in flash.

        • 1. Re: print keystroke
          moccamaximum Level 5

          //This will "print" the word SPACE on the stage when the SPACE-Key is pressed:


          import flash.events.KeyboardEvent

          import flash.ui.Keyboard

          import flash.text.TextField;


          stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);


          var tf:TextField = new TextField();


          tf.x = stage.stageWidth*.5;

          tf.y =stage.stageHeight*.5;


          function keyHandler(e:KeyboardEvent):void{

              if(e.keyCode== Keyboard.SPACE){

                  tf.text = "SPACE";



          • 2. Re: print keystroke
            Jakoza Level 1

            Hi MoccaMaximum, thanks for replaying but this not quiet what i wants. sorry if i was not clear.


            what i wants to do, is exactly like how i would do by my keyboard. lets say for example, I wants to say the word "Hello" in the chat client. But instate of writing it by my hand. I wants to use the flash widget, To write the word "hello" for me, when i click on the button that I specifed on the flash widget..

            • 3. Re: print keystroke
              moccamaximum Level 5

              with almost no details about how you implement your widget/chat-client I can give only a rough suggestion:


              helloBtn.addEventListener(MouseEvent.CLICK, helloHandler);

              function helloHandler(e:MouseEvent):void{

                 chat.text = "HELLO";


              1 person found this helpful