1 Reply Latest reply on Feb 11, 2007 11:48 PM by jonnybennett

    text input and comparison

    littlejohnny
      Hello everyone, sorry to be such a newb. Could someone outline some example syntax for me please. I am capturing the value for an input box and am outputting them into a dynamic text field. This is the first time i have worked in FLASH. I need to know how to test if the entry is correct (I will type a simple question on the screen and the user has to answer it). Please help to test both ucase and lcase string values.
        • 1. Re: text input and comparison
          jonnybennett Level 1
          In the simplest of examples to check one answer at a time on the assumption that the answer is in this case 'cat'..

          //You have a textfield with instance name 'yourUsersInputText'. And a movieClip
          //with an instance name, 'answerCheckBtn'

          answerCheckBtn.onRelease=function(){
          answer=yourUsersInputText.text.toLowerCase();
          if(answer=='cat'){
          trace('yes the right answer.');}
          else {trace('sorry pal that was the wrong answer.');}}

          //obviously you can simply change the trace for something else. Hoope this hels J.