1 Reply Latest reply on Mar 29, 2010 2:17 PM by Shongrunden

    Flex 4: Array to RadioButtons

    jsd99 Level 3

      I've got an array.  I want to make a bunch of radiobuttons, one for each element of the array.  In Flex 3 I used a mx:Repeater to do this.  Repeater no longer exists in 4.  How do I do it in Flex 4?  I think I have to use s:DataGroup but I can't figure it out.

        • 1. Re: Flex 4: Array to RadioButtons
          Shongrunden Adobe Employee

          Here is an example:

           

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark">
              
              <fx:Declarations>
                  <s:RadioButtonGroup id="rbGroup" />
              </fx:Declarations>
              
              <s:DataGroup>
                  <s:layout>
                      <s:VerticalLayout />
                  </s:layout>
                  <s:dataProvider>
                      <s:ArrayList>
                          <fx:String>one</fx:String>
                          <fx:String>two</fx:String>
                          <fx:String>three</fx:String>
                          <fx:String>four</fx:String>
                      </s:ArrayList>
                  </s:dataProvider>
                  <s:itemRenderer>
                      <fx:Component>
                          <s:ItemRenderer autoDrawBackground="false">
                              <s:RadioButton label="{data}" group="{outerDocument.rbGroup}" />
                          </s:ItemRenderer>
                      </fx:Component>
                  </s:itemRenderer>
              </s:DataGroup>
          </s:Application> 

           

          You might also be interested in this bug:

          http://bugs.adobe.com/jira/browse/SDK-25796