开发者

input text and check button

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 the开发者_运维知识库ir 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");
} 

}


Get rid of the eval()

if (ans1_box.text == "22"){
        message_box1.text = "Good job!!";
}else {
        message_box1.text = "Try again.";
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜