I have a datagrid that uses a radiobutton control as its item
renderer. The radio buttons are all part of the same group, which
will allow the user to select exactly one row from the datagrid.
Everything works, except when I call the numRadioButtons method on
the RadioButtonGroup object, it returns one more than the number of
RadioButton controls that are rendered - that is, one more than the
number of rows in the datagrid. When I reference a particular
button in ActionScript using the RadioButtonGroup's
getRadioButtonAt method, it appears that the extra button is in the
0th element of the group, and the first RadioButton control that is
rendered in the datagrid can be found in the 1st element of the
group (the second slot in the 'array').
It may be because the datagrid is ends up putting a radio
button in the group for the header row, which it shouldn't. To try
to overcome it, whenever I reference a button in the group, I just
add a +1 to the index (which is a bit unelegant, if effective). The
only problem is that the indexes of the real buttons increases each
time the datagrid is rendered on the stage (for example when I
leave the state containing the datagrid and then return to it).
This makes me wonder if an extra hidden button is really being
created or if somehow the datagrid and the RadioButtonGroup aren't
talking to each other correctly during the rendering. Does anyone
know why this happens, or how to surpress it?