5 Replies Latest reply on Jun 10, 2014 4:59 PM by kglad

    Simple equality check not working

    basil01

      Hi

      one of my students has an error, and I can't see it.

       

      He has a input text box (a), and he's looking to check that the user enters "one". If they get it right, it displays a message in dynamic text box (b)

       

      var x:String = "one";

       

      btn_done.onPress = function(){

       

        if (a.text != x){

        b.text="Wrong";

        trace(a.text);

        }

        else{

       

        b.text = "Right";

        }

      }

      No matter what one types, the response is "wrong". I've spent hours looking, but can't see the problem. Can anyone shed some light please?