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) {
   ExternalInterface.call("console.log", "Score Increased");
  } else {
   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.

  • \$\begingroup\$ AS3 provided class syntax, using prototype in general was outdated (even 10 years ago, hehe). Other than that the code looks like how I remember writing AS3. \$\endgroup\$ – Aaron Beall Dec 6 '19 at 0:20

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.