1
\$\begingroup\$

This loops through questions and the total score of correct answers:

AsClassName.prototype.getTotalScore = function() {
 var totalScore = 0;
 for (var i = 0; i < allQuestions.length; i++) {
  totalScore += allQuestions[i].getCalculatedScore();
   ExternalInterface.call("console.log", totalScore);
  if (currentModule.allQuestions[i].parent.questionCorrect == true) {
   knowledgePoints++;
   ExternalInterface.call("console.log", "Score Increased");
  } else {
   knowledgePoints--;
   ExternalInterface.call("console.log", "Score Decreased");
  }
 }
  debugLog("Total score: " + totalScore);
  return totalScore;
}

I have not worked with ActionScript for about 7 years. Does it have clean syntax, best practice etc? I am trying to 'add to the total score' with correct answers, and decrease with 'incorrect'.

My original Stack Overflow question describes my goal in full.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.