I’m building a form containing a number of checkboxes.
I haver something like this:
var oForm:Object = new Object();
oForm.click = function(eventObj)
{
var bSelected:Boolean = eventObj.target.selected;
trace("Selected: " + bSelected);
if (bSelected)
{
//trace ("score for this answer: " + eventObj.target.data);
}
}
for (var i = 0; i < oScreen.answers.length; i++)
{
var oCheckBox:CheckBox = mc.answers_mc.createClassObject(CheckBox, "answer_"+i, i);
oCheckBox._y = i*25;
oCheckBox.label = oScreen.answers*.text;
oCheckBox.data = oScreen.answers*.score;
oCheckBox.addEventListener("click", oForm);
}
Now this throws an error when compiling saying that the data property does not exist. And apparently it cannot be added to the checkbox as well.
Now how would I be able to get this to work? Basically each checkbox needs a label and an associated value (just like you can do with a radiobutton).
I find it rather strange that a checkbox does not have this property, or is that just me??