if the user’s input matches the value in the random array index then it traces true. even after I entered the right answer the trace is still false, can someone help me with this please. Thank you
var possible:Array=new Array()
var questionran:int
var plusran:int
var checker:int
questionran=Math.random()*12+1
if(questionran==1){
plusran=Math.random()*6+1
questionran=questionran+plusran
}
trace(questionran)
possible[12]=1
possible[11]=2
possible[10]=3
possible[9]=4
possible[8]=5
possible[7]=6
possible[6]=5
possible[5]=4
possible[4]=3
possible[3]=2
possible[2]=1
questionone.text="Suppose two dice are rolled and you want the sum of the two dice to be “+” “+String(questionran)+” "+
“How many ways can this occur?”
check1_btn.addEventListener(MouseEvent.CLICK,checking)
function checking(e:MouseEvent){
switch(e.currentTarget){
case check1_btn :
checker=possible[questionran]
trace(checker)
if(input1.text==String(checker)){
trace(“correct”)
}
else{
trace(“wrong”)
trace(input1.text)
}
}
}