# Scoring in Quiz

**URL:** <https://forum.kirupa.com/t/scoring-in-quiz/293314>\
**Category:** Uncategorized\
**Created:** [July 27, 2009, 11:06am UTC](https://forum.kirupa.com/t/scoring-in-quiz/293314 "2009-07-27T11:06:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gyan\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@Gyan\_Singh](https://forum.kirupa.com/u/Gyan_Singh)\
**Post date:** [July 27, 2009, 11:06am UTC](https://forum.kirupa.com/t/scoring-in-quiz/293314/1 "2009-07-27T11:06:04Z")

</div>

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…

```auto
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…???
