0

hai guys...

My project is to get a input text from user and user can check their answer by simply click on the button check, if their answer is true a message "good job" will be display. but,my code have an error..can u help to check this code 4 me? your help i really appreciate...

ans1_box.restrict = "0123456789"; var setUpProblem:Function = function():Void

{ // Clear the ans1_box and the message_box1 and place focus on message_box1

ans1_box.text = "";
message_box1.text = "";
Selection.setFocus("ans1_box");

}

//When the "CHECK" button is pressed, check the user's answer.

check_buton.onRelease = function():Void {

if (eval (ans1_box.text) == "22")
{
    message_box1.text = "Good job!!";
    }
else 
{
    message_box1.text = "Try again."; 
    //Selection.setFocus("ans1_box");
} 

}

skaffman
  • 398,947
  • 96
  • 818
  • 769

1 Answers1

0

Get rid of the eval()

if (ans1_box.text == "22"){
        message_box1.text = "Good job!!";
}else {
        message_box1.text = "Try again.";
}
Greg B
  • 14,597
  • 18
  • 87
  • 141
  • thank 4 helping me... i already get rid the eval() b4....but it still not working..for message box i set it as dynamic text..... – chiisai kodomo Dec 28 '09 at 01:58