I could use some help figuring out how to convert some older script to AS 3. I’ll start simple - here is the main class and a bit of code on the main timeline that calls it. I’m not certain how to declare the “settings” variable in AS 3 style. And I’m not sure how to call the “QuickCheck” public function from the main timeline.
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageDisplayState;
import flash.accessibility.AccessibilityProperties;
import flash.text.TextField;
import flash.text.TextLineMetrics;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
//----------------------------------------------------------------
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.media.SoundChannel;
//----------------------------------------------------------------
public class QuickCheck extends MovieClip {
//CUSTOMIZE//////////////////////////////////////////////////////////
var settings = new Object();
//correct color
settings.correctColor = "#85BB3D";
//incorrect color
settings.incorrectColor = "#CF7E05";
//weather feedback is shown or not
settings.hasFeedback = true;
//prefix for the answer choices
settings.choiceLetter = "A,B,C,D,E,F,G,H,I,J";
//space between the questions and answer chocies
settings.questionChoiceBuffer = 14;
//space between the answer choices
settings.choiceBuffer = 14;
//CONSTRUCTOR FUNCTION///////////////////////////////////////////////
public function QuickCheck(path, questionArr, directionsArr):void {
//reference to path
this.path = path;
this.questionArr = questionArr;
this.directionsArr = directionsArr;
this.currentQues = 0;
this.totalQues = questionArr.length;
this.currentAnswer;
this.submitOpen = false;
//trace("CONSTRUCTOR FUNCTION EXECUTED****************************");
}
/////////////////////////////////////////////////////////////////////
private function init(settings):void {
this.correctColor = settings.correctColor;
this.incorrectColor = settings.incorrectColor;
this.hasFeedback = settings.hasFeedback;
this.choiceLetter = settings.choiceLetter.split(",");
this.questionChoiceBuffer = settings.questionChoiceBuffer;
this.choiceBuffer = settings.choiceBuffer;
//trace("init() called");
}
}
///////////////
On Frame 18 of the main timeline (this is AS1.0/2.0 style script):
var activity = new QuickCheck(this, questionArr, directionsArr);
activity.init(settings);