Hello guys, I have a simple question I would like to ask.
I am trying to write and “if / else” statement. I want to take the user to a certain frame “prep” if the average of their three scores are below 90. However, whenever i click the button that should launch the function, it takes me to the “prep” frame regardless of the numbers i enter. hell, i dont even have to enter any numbers and it takes me there. don’t know what’s wrong?
Thanks.
Here’s the code. There are no naming issues.
stop();
var userName:String;
var userClass:String;
var userScore1:Number;
var userScore2:Number;
var userScore3:Number;
userName= name_txt.text;
userClass= class_txt.text;
userScore1= Number(score1_txt.text)
userScore2= Number(score2_txt.text)
userScore3= Number(score3_txt.text)
name_txt.text="";
class_txt.text="";
score1_txt.text="";
score2_txt.text="";
score3_txt.text="";
function showResults(event:MouseEvent):void
{
var totalScore:Number = userScore1 + userScore2 + userScore3;
if ( (totalScore/3) < 90 )
{
gotoAndStop("Prep");
}
else
{
gotoAndStop("Honors");
}
}
btnEnter.addEventListener(MouseEvent.CLICK, showResults)