Simple Quiz in Flash using Actionscript 2.0 tutorial

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
9,091
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Oct 7, 2009

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 = "";
}
};

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (4)

Sign In or Sign Up now to post a comment!
  • Is there any way if i just want 1 question like this for me to press enter and just proceed to the next frame?

  • I can't see behind that red box.

  • what dd u do to go to the next question?

  • I don´t see where do I have to write the "you win" message. thanks

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more