PDA

View Full Version : [AS3] how to create a fill in the blank question?


myBilingual
02-17-2009, 09:39 AM
hi,
I would like to create a trivia quiz.
Can anyone give me to example Code about how to create a fill in the blank question ?
Any help is appreciated.

jsimpson
02-17-2009, 06:45 PM
Put a textbox on the stage where the student should fill in the answer, change its type to input text. Change its name to something like questionOneInput_txt.


questionOneInput.txt.addEventListener(Event.CHANGE , compareQuestion1);

function compareQuestion1(e:Event):void{
if(questionOneInput_txt.text == "answer") // You'll want to process the text to make capitals not matter, etc
// logic for correct answer
else
// logic for incorrect answer
}


Something like that for a pretty basic test.