A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    5
    I have written a program which displays the value of a button pressed in a text field (much like a calculator). I have added the requirement to press the correct buttons in the correct sequence (answer key is off stage) much like a password. I have also set up this flash file to not require the submit button, but rather to check itself on the final keystroke equal to that of the answer key. My problem is that the display (textfield) only shows the numbers pressed that are equal to the answer key. How do I set it up so that it will display the value of any key pressed, but still check for correct on the final number? Please help!

    Thanks.
    [Edited by jpflashman on 08-30-2001 at 02:55 AM]

  2. #2
    I would simply add the pressed keys to a string and compare it with your password. if a wrong key is pressed the string is cleared and you start from the beginning.

    function checkkey(letter){
    keystrokes+=letter
    if (magicword.substr(0,keystrokes.length)!=keystrokes ){
    keystrokes=""
    } else {
    if (magicword==keystrokes)
    opensesame()
    }
    }

    This function assumes that "letter" already contains the keycode converted to a letter.

    Cheers
    Mario

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