How can I find out how many checkboxes are checked, please!
Hello everyone,
I have been at it for hours and pretty much cannot think straight and would highly apprecaite your help on this. I have an array called myArr which has 5 elements in it. I then generate checkboxes and the number of checkboxes are matched with the myArr.length(); I would like to be able to find out what checkboxes are check/selected before moving to the next screen. User will need to click on a "NEXT' button in order to move to the next screen. Next button is disabled until user selects the checkbox(s).
here is the code:
var cb:CheckBox;
captionArr:Array = new Array('img1' , 'img2', 'img3', 'img4', 'img5');
myArr:Array = new Array('c1', 'c2', 'c3', 'c4', 'c5');
for(var i:Number=0; i < myArr.length; i++)
{
cb = new CheckBox();
cb.y = i * 25;
cb.label = captionArr; // CHECKBOX LABELS
addChild(cb);
cb.addEventListener(MouseEvent.CLICK, clickHandler);
}
function clickHandler(e:MouseEvent):void
{
if(e.target.selected)
{
trace(''SELECTED");
}
else if(!e.target.selected)
{
trace("NOT SELECTED");
}
}
Thanks.