RadioButtonGroup with each RadioButton added in components?

Posted by futureal on Stack Overflow See other posts from Stack Overflow or by futureal
Published on 2010-05-25T23:57:53Z Indexed on 2010/05/26 0:01 UTC
Read the original article Hit count: 233

Filed under:
|

Hi,

Working in Flex 3, I have a series of components being rendered on a canvas, each of which should represent a single potential selection, ideally in a RadioButtonGroup. So in my parent canvas I am defining the RadioButtonGroup, and each component provides a single RadioButton. However, this doesn't seem to work.

Suppose there is a component called aComponent defined as such:

<mx:Canvas ...>
 ...
 <mx:RadioButton id="someButton" groupName="myRadioButtonGroup" ... />
</mx:Canvas>

The outer canvas:

<mx:Canvas ...>
 ...
 <mx:Script>
   public function doesSomething():void
   {
     var myComponent:aComponent = new aComponent();
     outerCanvas.addChild(myComponent);    
   }
 </mx:Script>
 ...
 <mx:RadioButtonGroup id="myRadioButtonGroup" />
</mx:Canvas>

So my guess was that at this point if, say, four of these components were added, the radio buttons would behave in mutually exclusive fashion and I'd be able to access myRadioButtonGroup.selectedValue to get the current selection. However, it doesn't seem to work that way.

Is what I'm trying to do even possible, or have I maybe just missed something?

Thanks!

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex3