Skip to main content
Dieses Thema wurde für Antworten geschlossen.

1 Antwort

Participant
January 16, 2013

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

Inspiring
January 16, 2013

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.