Learning English Online, Free English Lessons For Everyone
_Sponsors_
___ ______

How to create a Quiz in Flash using Actionscript 2.0 PDF Print
Written by Administrator   
Wednesday, 18 May 2011 20:58

 

How to create a Quiz in Flash using Actionscript 2.0

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

Last Updated on Friday, 08 July 2011 12:28
  ________


_____
We have 56 guests online

If you don't see anything in the middle of this page, you may need the latest Flash plug-in.
It only takes a few moments to
Download it FREE at Adobe.com. get adobe Flash player

Teaching English For Kids In Primary School

Stydying English Online For Everyone

Game for Kids


Home || Misterduncan|| Flash Cards || Songs For Kids|| Free Games || Learn English with GOGO|| Teaching English For Childern|| ESL/EFL Kids Course ||
Designed by Learning English Online. Designed by: Free Joomla Theme, mysql. Valid XHTML and CSS.