Buttons on keys
I have a hangman game that uses an input text field called 'letterIn_txt' where the user enters a letter and presses a button called 'guess_btn' which the user presses after enter a letter which turns it to capitals and if the guessed letter is equal to the inProgress word, it replaces it with the letter. I was wondering if I'm able to press keys between a-z to preform this making it easier for the user to play the game. It must turn to capital otherwise it wouldn't be seen as equal to the word. Here's how my button works so far.
this.guess_btn.addEventListener(MouseEvent.CLICK, playMe);
function playMe(Event:MouseEvent):void
{
guessLetter = this.letterIn_txt.text.toUpperCase();
for(var i = 0; i< wordLength; i++)
{
if(inProgress.charAt(i) == guessLetter)
{
myDisplay=guessLetter;
correctGuess=true;
rightCount++; }
}
I only want to know how I can press keys to preform this action on screen instead of typing the letter out and pressing the button. Any help would be great, thanks!
