The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 ViewsHey, so I just figured out how to do input fields that you can type in. I was just wondering how you would make a quiz like game. You type in your answer in the field, and then press a button and then it checks to see if it's right. If it is, go to the next frame. Would I have to learn about strings for this? Even if you just point me in the direction of a tutorial, it would be greatly appreciated. Also, I would like for this to be in AS2. I just don't like using AS3 when I don't have to.
Well you could come up with the question. And in the input field you could check. Do an if statement. Like if it is (correct answers) gotoAndStop (nextFrame) else "come up with something when they get it wrong"
At 7/16/11 01:35 AM, sonic180 wrote: Hey, so I just figured out how to do input fields that you can type in. I was just wondering how you would make a quiz like game. You type in your answer in the field, and then press a button and then it checks to see if it's right. If it is, go to the next frame. Would I have to learn about strings for this? Even if you just point me in the direction of a tutorial, it would be greatly appreciated. Also, I would like for this to be in AS2. I just don't like using AS3 when I don't have to.
I gave the field an instance name of 'field', the variable that holds the answer 'rightAnswer' and the button 'button'. I think this should be right; I'm quite new to Flash though, so I might make a mistake somewhere.
field.onRelease = function(){
var answer:String;
answer = field._text;
if (answer == rightAnswer){
nextframe();
} else {
tryAgain();
}
}
Alternatively, you can put this code in the button, although this makes proofreading the code frustrating:
on(release){
var answer:String;
answer = field._text;
if (answer == rightAnswer){
nextframe();
} else {
tryAgain();
}
}
Replace tryAgain(); with whatever you want it to do!
Sorry, it turns out that I did make a mistake! Please change nextframe to nextFrame.