# Class file

**URL:** <https://forum.kirupa.com/t/class-file/214231>\
**Category:** Uncategorized\
**Created:** [January 26, 2007, 3:18pm UTC](https://forum.kirupa.com/t/class-file/214231 "2007-01-26T15:18:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![puthem1st](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@puthem1st](https://forum.kirupa.com/u/puthem1st)\
**Post date:** [January 26, 2007, 3:18pm UTC](https://forum.kirupa.com/t/class-file/214231/1 "2007-01-26T15:18:48Z")

</div>

Hello I need some assistance with my class file. What I am doing is I have a quiz with different subjects in a combo box that the user can select (Math, chemistry, social studies…). What I want is to attach a separate class fiel for each subject that will display the problem and check the users anwer. Here is what I have so far, but its not working properly. My questions work fine within flash but when I use the class file it doesn’t function. Thanks for your help.

Class Math ()  
//This is variable set up to get the users infor  
var youranswer:String;  
function Math() {  
}  
}

//This displays the question

private function displayequation () {  
var myEquations:Array = [];  
var myOperators:Array = ["+","-","_","/"];  
for (var i:Number = 0;i \< 10;i++) {  
var num1:Number = Math.round((Math.random() \* 50) + 1);  
var num2:Number = Math.round((Math.random() \* 50) + 1);  
var randOp:Number = Math.round(Math.random() \* (myOperators.length - 1));  
var temp:String = num1.toString() + " " + myOperators[randOp] + " " + num2.toString();  
//var temp:String = num1.toString() + myOperators[randOp] + num2.toString();  
trace(“this is random string " + i + “: " + temp);  
myEquations.push(temp);  
}  
var currentEq:Number =0;  
var setEquation:Function = function() {  
eq\_txt.text = myEquations[currentEq];  
}  
var checkFunction:Function = function() {  
var ta:Array = myEquations[currentEq].split(””);  
trace ("here’s ta: " + ta);  
var tmp:Number;  
switch(ta[1]) {  
case “+” :  
trace (“we’re adding”);  
tmp = parseInt(ta[0]) + parseInt(ta[2]);  
break;  
case “-” :  
trace (“we’re subtrating”);  
tmp = parseInt(ta[0]) + parseInt(ta[2]);  
break;  
case "_" :  
trace(“we’re multiplying”);  
tmp = parseInt(ta[0]) + parseInt(ta[2]);  
break;  
case “/” :  
trace (“we’re dividing”);  
tmp = parseInt(ta[0]) + parseInt(ta[2]);  
break;  
}  
trace (“and tmp is: " +tmp);  
if (tmp.toString() == ans\_txt.text) {  
trace(“Correct!”);  
ans\_txt.text=”";  
currentEq ++;  
setEquation();  
} else {  
trace(“wrong!”);  
}  
}  
}  
setEquation();  
check\_mc.onRelease =checkFunction;
