Check input fields with Array
Hi All,
I'm making a quiz where the user inputs the answer into an input box. I've been trying to use an array to check the answer against.
I have set it up to have 1 question per frame and want to have an array with multiple answers to the question on the frame.
What I currently have;
var CorrectAnswer1: Array = ["DBMS", "dbms", "Database Management System"];
submit.addEventListener(MouseEvent.CLICK, check)
function check(e: MouseEvent): void {
if (ans1.text == CorrectAnswer1[0,1,2]) {
result1.text = "Correct";
} else {
result1.text = "Incorrect";
}
}
The error it gives;
ReferenceError: Error #1069: Property 2 not found on Number and there is no default value.
at UniversalRevision_TEST_fla::MainTimeline/check()
I also tried;
var CorrectAnswer1: Array = new Array ["DBMS", "dbms", "Database Management System"];
Can anyone point me in the right direction how to properly use an array and check against it?
Here's what the frame looks like:
Pardon the really bad writing, not easy with a mouse![]()
Thanks,
Jack
