You can try using the group property of RadioButton. I've coded up a simple
example. The only issue with my sample is that the RadioButtons get added in
the wrong order. You'll need to add some logic to get them attached in the
correct order. 

Jason

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 14, 2005 4:40 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Radio Button Custom Component


That does make sense.  It's a bit of pain for what we're trying to do.
 But we'll find a workaround.  We're dealing with a ton of dynamic
data that is being used to generate in turn a dynamic interface. 
We'll just have to figure out a way to get the RadioButtons grouped in
the same container.  Thanks for the detailed explanation,

-- Matthew

On 4/14/05, Jason Szeto <[EMAIL PROTECTED]> wrote:
> 
> Let me explain what is going on here and why it has been done this way.
> 
> Let's say you've got a MXML Component called myChoice. It contains three
> RadioButtons, called rA, rB, & rC. You assign each of these a groupName
> called myGroup. It also has a member variable called dataProvider. The way
> that you use this component is that you set the dataProvider property,
which
> then sets the label and data properties of each of your three
RadioButtons.
> 
> Now in your main application, you instantiate three of these myChoice
> components, called cA, cB, & cC.
> 
> In this application, would you expect all nine RadioButton be part of a
> single group called myGroup? No, you'd expect that there would be three
> groups and that the RadioButtons within each component are only a part of
> the internal group of the component. The same thing with the dataProvider
> property. You wouldn't expect that this property would be shared among all
> three components.
> 
> What is happening under the covers is that a RadioButtonGroup with the id
> "myGroup" is created as a member variable of the myChoice component.
> 
> So in short, radio buttons can only share a RadioButtonGroup if they are
> within the same class. (Remember that each MXML file is its own class.)
> 
> Jason
> 
> -----Original Message-----
> From: jwaknitz [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 14, 2005 10:59 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Radio Button Custom Component
> 
> I tried that, to no avail.  :(
> 
> --- In flexcoders@yahoogroups.com, Deepa Subramaniam <[EMAIL PROTECTED]>
> wrote:
> > I don't see a <mx:RadioButtonGroup> tag in your code anywhere.
> This tag is
> > what defines the group which your RadioButtons will work as a
> single control
> > under. You can also use this tag to specify the labelPlacement for
> all the
> > RB's in the group.
> >
> > So I think what you need is outside of your Repeater this:
> >
> > <mx:RadioButtonGroup id="group1" labelPlacement="right" />
> >
> > Check out the ASDocs for more info.
> >
> > -----Original Message-----
> > From: jwaknitz [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 14, 2005 10:47 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Radio Button Custom Component
> >
> >
> >
> > I went back to the script and changed the if statement to create a
> > RadioButton directly to the app and not grab a component.  This
> > fixed the group problem but is not the fix that I wanted.
> > Components is much nicer for what I want as the other way has
> > generated a few problems with my design.
> >
> > Does anyone have any input about why the groupName attribute
> doesn't
> > seem to work between components?
> >
> >
> > --- In flexcoders@yahoogroups.com, Matthew Shirey <[EMAIL PROTECTED]>
> > wrote:
> > > I am working with Jack and I am familiar with his problem.
> There's
> > a few
> > > reasons why we're using a component with a radio control inside
> > it. Our
> > > problem is that it seems to be ignoring the groupName property.
> Do
> > radio
> > > controls have to all exist inside the same parent container to
> > work as a
> > > group? I have looked in the documentation and didn't see any
> such
> > > limitation. Maybe I missed it. Shouldn't you be able to put
> radio
> > buttons
> > > anywhere in the application and as long as they all have the
> same
> > groupName
> > > they all behave as a group?
> > >
> > > -- Matthew
> > >
> > > On 4/13/05, Tracy Spratt <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > Why not just use straight mxml. The following works for me.
> > > >
> > > > <mx:VBox id="vboxRG" x="3" y="3" >
> > > > <mx:Repeater id="repeaterRB"
> > dataProvider="{leParameter.valuesarray}"
> > > > >
> > > > <mx:RadioButton id="RBParameter" groupName="RGBParameter"
> > > > data="{repeaterRB.currentItem[0]}"
> > > > label="{repeaterRB.currentItem[labelColumn]}"
> > > > click="setParameterValue(event)"
> > > > width="{this.width-6}"/>
> > > > </mx:Repeater>
> > > > </mx:VBox>
> > > >
> > > > Tracy
> > > >
> > > > -----Original Message-----
> > > > From: jwaknitz [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, April 13, 2005 1:16 PM
> > > > To: flexcoders@yahoogroups.com
> > > > Subject: [flexcoders] Radio Button Custom Component
> > > >
> > > > I'm using a repeater to grab a component that makes a
> radiobutton
> > > > each time.
> > > > When the app is displayed, there are 7 radiobuttons. The
> problem
> > > > is, they are not in the same group. They are all individually
> > > > checkable. I went into the component and gave the radiobutton a
> > > > groupName="group1". All of the radiobuttons then had the same
> > > > groupName. The problem was still there.
> > > >
> > > > I also tried putting the component call within a
> RadioButtonGroup
> > > > component and had no luck.
> > > >
> > > > Anyone have any solutions to this?
> > > >
> > > > *----------------------------------------* App:
> > > >
> > > > <mx:Script>
> > > > <![CDATA[
> > > >
> > > > var compData3:Object;
> > > > var compData4:Object;
> > > >
> > > > function repeaterfunc(){
> > > > if(repradio.currentItem.nodeName == "response_lid"){
> > > > compData3 = cont.createChild
> > > > (Components.RadioButtons.labelbuttoncomp);
> > > > compData3.compData4 = repradio.currentItem;
> > > > }
> > > > }
> > > > ]]>
> > > > </mx:Script>
> > > >
> > > > <mx:Repeater id="repradio" dataProvider="{compData2.childNodes
> > > > [1].firstChild.childNodes}" repeat="repeaterfunc()"/>
> > > >
> > > > <mx:VBox id="cont"></mx:VBox>
> > > >
> > > > *----------------------------------------* Component:
> > > >
> > > > <mx:Script>
> > > > <![CDATA[
> > > >
> > > > var compData4;
> > > >
> > > > ]]>
> > > > </mx:Script>
> > > >
> > > > <mx:RadioButton
> > > >
> >
> label="{compData4.firstChild.firstChild.firstChild.firstChild.firstCh
> > > > ild.firstChild}" groupName="group1" labelPlacement="right"/>
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> 
> Yahoo! Groups Links
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Attachment: rbgComp.mxml
Description: Binary data

Attachment: rbgDynamic.mxml
Description: Binary data

Reply via email to