Skip to main content
Known Participant
June 27, 2007
Question

Keyboard input

  • June 27, 2007
  • 1 reply
  • 290 views
I have a crossword that I want to limit the key presses to just letters. So if they press anything that isnt a letter it wouldnt do anything. Does anyone know how to do something like this in AS2.0? Thanks
This topic has been closed for replies.

1 reply

Participating Frequently
June 27, 2007
Hi,

Yes, you can limit the possible input to the text fields used in your application. The restrict property of your text field can define what characters are allowed:

my_textfeild.restrict = "A-Z a-z";

...allows for only upper and lower case chars and nothing else.

Another approach might be to use a key listener ( Key.addListener( object ) ) to catch keystrokes and evaluate the char codes. See:
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002295.html
Known Participant
June 27, 2007
if I have a KeyListner how can I restrict the key strokes to just letters? Do I use the mytextField.restrict?