dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Input Text Question - Simple

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Posts
    172

    Input Text Question - Simple

    Hello there.
    I'm building a very simple chat application. There is an input text box to send chat messages to the room. What I want to do is: to activate the input text on ANY key so that whatever the user presses will be inputted to the textbox without the need to click and activate the textbox. is there any way to enable that ability ?

    Thank you.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You can add a KEY_DOWN or KEY_UP event to the stage which puts the pressed key into the textbox.
    Code:
    stage.addEventListener(KeyboardEvent.KEY_UP, addLetter);
    
    function addLetter(e:KeyboardEvent):void{
      someTextBox.appendText(String.fromCharCode(e.charCode));
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center