I am working on a math game, each image loads up and i have a text box to put the answer in, check answer button, and a message that comes up correct or incorrect. When I go to run it I get the error.
TypeError: Error #1010: A term is undefined and has no properties.
at QuizTwoThree_fla::MainTimeline/checkAnswer()
I have a background in C++, I am not sure if i did not end the loop correctly or what term is not defined. I even went back up to the top and copied and pasted all the variables back over.
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.text.TextField;
stop();
theEnd.visible=false;
var theQuestions:Array = [bob1,bob2,bob3,bob4,bob5,bob6,bob7,bob8,bob9,bob10,bob11,bob12,bob13,bob14,bob15];
var theAnswers:Array = [6.57,7.63,12.44,7.47,7.14,5.39,16.91,3.09,2.03,10.15,15.12,5.27,3.27,2.28,5.55];
var placement:int;
var temp:MovieClip;
var temp2:int;
var currentQuestion:int =0;
var score:int = 0;
var correct:MovieClip;
var inputText:TextField;
var scoretwo:int =0;
for(var n=0;n<15;n++)
{
theQuestions[n].visible=false;
}
for(var i=0; i<15; i++)
{
placement = (Math.ceil(Math.random()*15));
temp = theQuestions*;
theQuestions* = theQuestions[placement];
theQuestions[placement] = temp;
temp2 = theAnswers*;
theAnswers* = theAnswers[placement];
theAnswers[placement] = temp2;
}
theQuestions[0].visible=true;
theButton.addEventListener(MouseEvent.CLICK, checkAnswer);
function checkAnswer(e:MouseEvent):void
{
if(Number(inputText.text)==theAnswers[currentQuestion])
{
correct.gotoAndPlay(2);
score++;
trace(score);
}
else
{
scoretwo++;
correct.gotoAndPlay(3);
trace(scoretwo);
}
theQuestions[currentQuestion].visible=false;
currentQuestion++;
theQuestions[currentQuestion].visible=true;
}
I included a zip of the FLA file, so you can see the random issues I get when it runs
thank you for taking a look