Copy link to clipboard
Copied
This question was posted in response to the following article: http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f50.html
Copy link to clipboard
Copied
I have 12 Check box compontents that work Independently turning items on and off. I want to be able to turn all the check boxes on or off but I'm having a hard time figuring out the code. Please help e-mail answer to michael.t.spinella@nga.mil. -Mike
Copy link to clipboard
Copied
Asssuming you use the AS3 standard checkbox components:
//Three Checkboxes with names cb1,cb2,cb3 on stage
cb1.label = "1";
cb2.label = "2";
cb3.label = "1+2+3";
//the default behaviour of the third Checkbox is enhanced to toggle 1 and 2 also
cb3.addEventListener(Event.CHANGE, toggleAll);
function toggleAll(e:Event):void{
if(cb1.selected == true && cb2.selected == true){
cb1.selected = cb2.selected = false;
}
else{
cb1.selected = cb2.selected = true;
}
}
Use this as a template for your 12 Checkbox problem.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now