1 Reply Latest reply on May 14, 2009 8:38 AM by Michael Borbor

    How to set selected radioButton

    master.card Level 1

      Hi,

       

      There are tons of examples on the websites to show you how to detect selected radioButton or click event. But It is not easy to find aone example to show you how to set selected radioButton.

       

      Here is my code, but not working, Is it not well handle on it for Flex?

       

      [Bindable]       
      private var selectedRadioButton:RadioButton;

      private function initSelect(): void {
              selectedRadioButton = rb1;
      }

      ...

      <mx:RadioButtonGroup id="rbg" selection="{selectedRadioButton}"
                         change="rbg_change(event);" />
                      <mx:HBox>
                    <mx:RadioButton id="rb1"
                            label="Active" group="{rbg}" />
                    <mx:RadioButton id="rb2"
                            label="Lock" group="{rbg}" />
      </mx:HBox>

       

       

       

      Thanks

        • 1. Re: How to set selected radioButton
          Michael Borbor Level 4

          it's simple set its selected property true. For instance

           

          myRadioButtonSelectedOnStart.selected="true"

           

          Sincerely,

           

          Michael

           

          El 14/05/2009, a las 10:32, "master.card" <forums@adobe.com> escribió:

           

          >

          Hi,

          >

          There are tons of examples on the websites to show you how to detect 

          selected radioButton or click event. But It is not easy to find aone 

          example to show you how to set selected radioButton.

          >

          Here is my code, but not working, Is it not well handle on it for 

          Flex?

          >

          private var selectedRadioButton:RadioButton;

          private function initSelect(): void {

                  selectedRadioButton = rb1;

          }

          ...

          <mx:RadioButtonGroup id="rbg" selection=""

                             change="rbg_change(event);" />

                          <mx:HBox>

                        <mx:RadioButton id="rb1"

                                label="Active" group="" /> >               <mx:RadioButton id="rb2" >                       label="Lock" group="" />

          </mx:HBox>

          >

          >

          >

          Thanks

          >