Multi Answer Question? Help appreciated!

I’m hoping someone out there knows more about Flash than me :crying:

I’m trying to write a multiple answer question for a project I’m working on. From a list there is more than 1 correct answer. I hadn’t got a clue where to start so I started by looking at the tutorial for a creating a form using components.

My thinking is that if I can harness the values for the checkboxes the user selects then I can (??) compare them to a variable for the correct answer and base my feedback on this.

I am basing the code below on 5 checkboxes with instance names A-E. I have one reset button and one submit button.

With me so far…Here’s my code:

[color=black]correctAnswer = [B,C,E]; [color=red]// just an example[/color] [/color]
[color=red]// define my checkbox instance names[/color]
myCheck = [A,B,C,D,E];

[color=red]// record what’s selected[/color]
function checkDisplay(component) {
var options,ticked;
for(options in myCheck){
if(myCheck[options].getValue()) ticked += myCheck[options].getLabel();

[color=red]// set a variable to contain what was selected[/color]
myAnswer = ((ticked.length) ? ticked : “”);

[color=red]// the usual…(whatever that means)[/color]
for (i=0;i<myCheck.length;i++) {
myCheck*.setChangeHandler (“checkDisplay”);

[color=red]// reset checkboxes function[/color]
onReset = function () {
var options;
for (options in myCheck) {

[color=red]// submit what the user has selected - it is here I want the evaluation bit to occur[/color]

onSubmit = function () {

It is when the user clicks on the submit button that I want to compare myAnswer to a correctAnswer variable and based a feedback path on whether they match or not (if…else…).

At the minute the myAnswer variable is returning the checkbox labels. I’d ideally like it to return the instance names/option numbers and make a comparison to the correct answer.

I’m sure I’m going about this completely the wrong way - hopefully someone can help :wink: