Hello I’m Acronikos. I’m an owner of Flash 8 and I’ve been learning to program with actionscript through the book Beginning Flash Game Programming for Dummies. Anyway, I’m learning to build a Math program that lets the user select Addition, Subtraction, Multiplication, or Division. Once the use decides, it gives them a sample problem. No matter if they answer correctly or incorrectly the result page is giving me problems. On the result page is supposed to be the number of questions they got right (numRight) and the number of questions (numTries) that they’ve answered. So, everytime I first run this program, the first problem, on the result page says NAN in both numRight and numTries fields. I cannot explain this. Why does it say NAN? There is no mention of NAN in my code:
//code in report frame
//from mathBetter.fla
//check to see if user is right
if (_root.guess == _root.correct){
result = “Great Job!”;
numRight++;
} else {
result = x + op + y + " = " + correct;
} //end if
//op is the sign such as +, -, *, or /
//update score
numTries++;
percRight = numRight/numTries * 100;
//back up button goes different places in different situations!
btnBack.onRelease = function(){
if (numTries < 5){
//create another problem in the same set
_root.gotoAndStop(“solve”);
} else {
//let user start over
numRight = 0;
numTries = 0;
_root.gotoAndStop(“homePage”);
}//end if
} //end back release
I hope I explained this well enough…if not feel free to ask questions. I really would like some feed back because its just one small flaw that needs fixing. After the first try and the NAN result page, every time after is all correct. Please help if you can. Thanks in advance.
~Acronikos