Ok, I am new to Flash and this is my first big project at work:
I am creating a training to test meter readers. As the assessment part, there will be an 4 input boxes where the user puts in the reading they got (1 digit per box). When they hit a button on the bottom (or hit “Enter”) it checks to see if they got the right reading. If they did, a text box will show “Correct.” If they didn’t, the text box will show “Incorrect” and the correct number will appear above the ones they got wrong.
My problem is:
I am not sure how to make it so when they hit the button, it will check all the input boxes to see if they are right, thus showing a Correct or Incorrect.
I am not sure how to have the correct number appear, if they missed just that particular one.
Suggestions?? No fla for this one, just trying to plan out the AS so when I build it, I do it right.
That looks pretty similar to code that I used a little while after I posted. (I found a tutorial on passwords here at kirupa that helped, I just fiddled with it a little to have it do what I intended.)
I’ll look around to see what I can find on arrays before I keep going, but will that allow me to have the correct answer appear only for the ones that they missed?
Example: My reading is 3 0 5 9 and they input 3 9 5 9. I want only the 0 to show up above the 9 they inputted.
Have you read any “quiz” tutorials? I know that there are several out there - they could prolly help you.
For your situation, you might want to try something like this.
ansArray = ["3","0","5","9"];
for(i=0; i<ansArray.length; i++){
var ansIn:String = ["ansInput"+i].text;
var ansReal:String = ansArray*;
if(ansIn != ansReal){
// we can either change an incorrect answer to a correct one...
ansIn = ansReal;
// or output the correct answer to a different text box
["ansResult"+i].text = ansReal;
}
}