1) if the letter input by the user matches a letter in the word then have that letter appear in the appropriate text box (should be able to use array returned by prototype to target appropriate text box right?)Code:// this assumes your word is in string 'wordStr' and your letter_boxes are named letter0 thru letterN function showMatchingLetter(letter) { for (i = 0; i < wordStr.length; ++i) { if (wordStr.charAt[i] == letter) { _root["letter"+i].text = letter; } } }2) how do you write an if statement for an empty array? if array returned by prototype is empty then the user guessed a letter that isn't in the word.Code:if (array == undefined || array.length == 0) { // array is non-existant or empty }Put the code you are currently using to setup your code into a function.3) Create a new word when the 'play again' button is pressed.
Call this function once after you define it, to setup your game. Call it again, when the user presses the 'play again' button.
You will probably find that to reset the game, you will need to do a few additional things, such as reset the various arrays you have been usingCode:function setupGame() { // code you are currently using to setup the game... } setupGame(); // call it once to set things up..
myArray = [];
and clear the contents of your text boxes.
- Jim




Reply With Quote