A simple tutorial to help you create a quiz in Flash using Actionscript 2.0.
If you cannot see, this is the information you must give in the text boxes:
Dynamic textbox: Variable name- "Category"
Dynamic textbox: Variable name- "Questions"
Input textbox: Instance name- "Answer"
Code 1 (Copy and paste this in the frame):
//Originally made by EasyCoding, visit www.youtube.com/EasyCoding for more tutorials.
//Set the current round to 0, so we can use it to find which question we are on and use it to find the round info:
var currentround = 0;
//The array of questions, containing each rounds information in this format:
//Category, Question, Answer
questions = [
//Make sure all of your answers (that's the jay, 3.14 and france are in lowercase, or the quiz will not work
[ "The Simpsons","What is Homers middle name?","jay"],
["Math","What is pi to 2 decimal places?","3.14"],
["Geography","Where is Paris?","france"]
];
//The function that checks for the answer. It needs to be on an onEnterFrame function so it checks every frame.
onEnterFrame = function () {
//Sets the value of the dynamic text box named Category to the value of questions[currentround][0],
//which would mean: in the array named questions, in the line down of the current round, Category =
//the text in 0'th place, which is "The Simpsons".
Category =questions[currentround][0];
//Makes the textbox Questions the value of questions[currentround][1];
Questions=questions[currentround][1];
//Checks to see if the answer is correct and the Enter key is down, and if it is then it adds one to
//current round which changes the category, question and answer.
if ((Answer.text.toLowerCase() == questions[currentround][2]) && Key.isDown(Key.ENTER)) {
currentround++;
Answer.text = "";
}
};
Is there any way if i just want 1 question like this for me to press enter and just proceed to the next frame?
charliemagneowns 1 week ago
I can't see behind that red box.
evramos70 1 year ago
what dd u do to go to the next question?
kete31 1 year ago
I don´t see where do I have to write the "you win" message. thanks
najupobo 1 year ago