SteveH
03-28-2008, 06:45 PM
Hello
I have a Flash quiz which I have downloaded (it was free) and eventually hope to post something like it online, but I need first to come to terms with what is going on in the Timeline.
After answering a question the
function answer (choice) {
advances the user to the next question and at the end of the two questions (!), a total score is given.
The Action Script looks like this:
var quizTimeline = this; // Stores reference to the timeline that contains the quiz user interface.
var numQuestions = 2; // Number of questions in the quiz
var q1answer; // User's answer for question 1
var q2answer; // User's answer for question 2
var correctAnswer1 = 3; // The correct choice for question 1
var correctAnswer2 = 2; // The correct choice for question 2
answer.currentQuestion = 0; // Function property: the question being answered
If I wished to add a third or fourth question, or any number of questions, I understand that I need to add to the AS as follows:
var numQuestions = 5; // Number of questions in the quiz
var q1answer; // User's answer for question 1
var q2answer; // User's answer for question 2
var q3answer; // User's answer for question 3
var q4answer; // User's answer for question 4
var q5answer; // User's answer for question 5
var correctAnswer1 = 3; // The correct choice for question 1
var correctAnswer2 = 3; // The correct choice for question 2
var correctAnswer3 = 1; // The correct choice for question 3
var correctAnswer4 = 2; // The correct choice for question 4
var correctAnswer5 = 1; // The correct choice for question 5
What I am unsure about is how to customise the Timeline. I have copied and pasted frames and tried to change the nature of the questions asked (and their numbers) graphically on the stage, but I cannot get it to work doing that. For example, under question 2 I can see question 1, etc after pressing Ctrl + Enter.
What would be the best way of proceeding? I can post the file if it helps.
Many thanks.
Steve
I have a Flash quiz which I have downloaded (it was free) and eventually hope to post something like it online, but I need first to come to terms with what is going on in the Timeline.
After answering a question the
function answer (choice) {
advances the user to the next question and at the end of the two questions (!), a total score is given.
The Action Script looks like this:
var quizTimeline = this; // Stores reference to the timeline that contains the quiz user interface.
var numQuestions = 2; // Number of questions in the quiz
var q1answer; // User's answer for question 1
var q2answer; // User's answer for question 2
var correctAnswer1 = 3; // The correct choice for question 1
var correctAnswer2 = 2; // The correct choice for question 2
answer.currentQuestion = 0; // Function property: the question being answered
If I wished to add a third or fourth question, or any number of questions, I understand that I need to add to the AS as follows:
var numQuestions = 5; // Number of questions in the quiz
var q1answer; // User's answer for question 1
var q2answer; // User's answer for question 2
var q3answer; // User's answer for question 3
var q4answer; // User's answer for question 4
var q5answer; // User's answer for question 5
var correctAnswer1 = 3; // The correct choice for question 1
var correctAnswer2 = 3; // The correct choice for question 2
var correctAnswer3 = 1; // The correct choice for question 3
var correctAnswer4 = 2; // The correct choice for question 4
var correctAnswer5 = 1; // The correct choice for question 5
What I am unsure about is how to customise the Timeline. I have copied and pasted frames and tried to change the nature of the questions asked (and their numbers) graphically on the stage, but I cannot get it to work doing that. For example, under question 2 I can see question 1, etc after pressing Ctrl + Enter.
What would be the best way of proceeding? I can post the file if it helps.
Many thanks.
Steve