In a Flex App I have some groups of checkboxes with similar ids At the definite moment only one group is accessible for checking
group 10
id="chkBox101"
id="chkBox102"
id="chkBox103"
group 20
id="chkBox201"
id="chkBox202"
id="chkBox203"
group 30
id="chkBox301"
id="chkBox302"
id="chkBox303"
....
....
....
I have an variable that "knows" witch group of checkboxes is accessible for selecting
var selCB: String = 10; // it changes to 10, 20, 30, 40, 50 ....
I want to use the same function for all the groups to check which checkboxes is selected. How to replace the XX in the following function with the value of selCB ???
private function checkTheCheckBoxes() void:
{
if { chkBoxXX1.selected == true || chkBoxXX2.selected == true || chkBoxXX3.selected == true }
then {
doSomething();
}
开发者_JAVA百科 else
{
doSomethingElde();
}
}
So, for example, in the case of group 10 (selCB=10) the function should look like:
private function checkTheCheckBoxes() void:
{
if { chkBox101.selected == true || chkBox102.selected == true || chkBox103.selected == true }
then {
doSomething();
}
else
{
doSomethingElde();
}
}
Thanks in advance.
Can't you loop through all the children of the group?
Something like for each (var o : RadioButton in radioGroup.getAllChildren()) ...
Hope this helps.
精彩评论