Hi all. I’ve got a simple quiz form that I’ve set up using radio buttons. Everything works great where you have to log in to advance to the next frame. The only problem is that I cant get the submit button (which is on the 2nd frame) to register. I’ve tried using “._parent” which still didnt work. Im confused. Im not really using this for anything, but I was just messing around with some actionscript.
I’ll attach the code and see what you guys think:
this.stop();
// variables for username and password
var sUserName:String = tUserName.text;
var sPassword:String = tPassword.text;
//input name and password to advance to next frame
mcPasswordSubmit.onRelease = function():Void {
if (this._parent.tUserName.text == "username" && this._parent.tPassword.text == "password") {
this._parent.nextFrame();
}
else{
this._parent.tUserName.text == "";
this._parent.tPassword.text == "";
Selection.setFocus(this._parent.tUserName);
}
};
// keeps track of score
function calculateScore():Void {
var bScoreOne:Boolean = (crbgName.selectedData == "Answer1");
var bScoreTwo:Boolean = (crbgLive.selectedData == "Answer2");
var bScoreThree:Boolean = (crbgWork.selectedData == "Answer3");
var nScore:Number = 0;
if (bScoreOne) {
nScore++;
}
if (bScoreTwo) {
nScore++;
}
if (bScoreThree) {
nScore++;
}
//Outputs score to user
tQuizScore.text = ("You Answered "+nScore+" out of 3 Questions Correctly");
}
// sets up submit button for results
mcSubmit.onRelease = function():Void {
calculateScore();
};