Flex:如何更改函数中的目标 id?
在 Flex 应用程序中,我有一些具有相似 id 的复选框组 在特定时刻,只有一组可用于检查
group 10
id="chkBox101"
id="chkBox102"
id="chkBox103"
group 20
id="chkBox201"
id="chkBox202"
id="chkBox203"
group 30
id="chkBox301"
id="chkBox302"
id="chkBox303"
....
....
....
我有一个变量“知道”复选框组可用于选择
var selCB: String = 10; // it changes to 10, 20, 30, 40, 50 ....
我想对所有组使用相同的函数来检查选中了哪些复选框。 如何将下面函数中的XX替换为selCB的值???
private function checkTheCheckBoxes() void:
{
if { chkBoxXX1.selected == true || chkBoxXX2.selected == true || chkBoxXX3.selected == true }
then {
doSomething();
}
else
{
doSomethingElde();
}
}
因此,例如,在组 10 (selCB=10) 的情况下,函数应如下所示:
private function checkTheCheckBoxes() void:
{
if { chkBox101.selected == true || chkBox102.selected == true || chkBox103.selected == true }
then {
doSomething();
}
else
{
doSomethingElde();
}
}
提前致谢。
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();
}
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能循环遍历该组的所有子节点吗?
类似于
for every (var o : RadioButton in radioGroup.getAllChildren()) ...
希望这会有所帮助。
Can't you loop through all the children of the group?
Something like
for each (var o : RadioButton in radioGroup.getAllChildren()) ...
Hope this helps.