Hi Friends,
I am making a quiz…
There are some inputTextField on the stage, and user need to fill them.
for example…
Q1. temperature of Mumbai…
A1. … // “temp_mumbai” is the instance of input text.
Q2. temperature of Jaipur…
A2. … // “temp_jaipur” is the instance of input text.
now I need to check the answer…
So I wrote code like that…
var totScore:Number = 0;
submitBtn.addEventListener (MouseEvent.CLICK, checkAns);
function checkAns (e:MouseEvent):void {
chek (temp_mumbai, "30", 1);
chek (temp_jaipur, "45", 1);
}
function chek (txt:TextField, answer:String, score:Number) {
var myTxt:String;
myTxt = txt.text;
if (myTxt == answer)
{
totScore = totScore + score;
trace ("totScore : " + totScore);
} else
{
trace ("totScore : " + totScore);
}
}
I get correct score one time but if user click on submitBtn again the score has change…
and I can’t get proper score…
Please help me… how can I get Proper score…???