Handy Quiz ActionScript
I know...I should be learning AS3. But I'm still tucking this away for a Flash quiz addition. (Source: Live Docs)
var correctAnswers:Number = 11;
var totalQuestions:Number = 13;
//round to the nearest integer
//var score:Number = Math.round(correctAnswers / totalQuestions * 100);
//round to two decimal places
var score:Number = Math.round(correctAnswers / totalQuestions * 100 * 100) / 100;
trace("You got " + correctAnswers + " out of " + totalQuestions + " answers correct, for a score of " + score + "%.");
var correctAnswers:Number = 11;
var totalQuestions:Number = 13;
//round to the nearest integer
//var score:Number = Math.round(correctAnswers / totalQuestions * 100);
//round to two decimal places
var score:Number = Math.round(correctAnswers / totalQuestions * 100 * 100) / 100;
trace("You got " + correctAnswers + " out of " + totalQuestions + " answers correct, for a score of " + score + "%.");
0 Comments:
Posta un commento
<< Home