1 Reply Latest reply on Aug 2, 2010 1:18 AM by Niranjan_swain

    Creating dynamic Radio Buttons and Buttons

    Nirmal Kumar Bhogadi

      Hello All,

       

      Presetly I am working on below functionality:

       

      I have an ArrayCollection which is like

       

      var sampleCollection:ArrayCollection = new ArrayCollection( [ {"filterID:1", filterName:"Occupied" },  {"filterID:2", filterName:"Unccupied" }] );

       

      Now my requirement is to create a RadioButton  and a Normal Button for every element in the ArrayCollection.

       

      So basically the UI will be "RadioButton, Occupied, Button, Button".

       

      Can someone help me in this respect.

       

      Thanks in advance,

      Nirmal Kumar Bhogadi.

        • 1. Re: Creating dynamic Radio Buttons and Buttons
          Niranjan_swain

          HI Nirmal,

           

          If u want to create the radiobuton and abutton according to the arraycollection data then u follow the following principle.

           

          Take a vbox. this is contains all the rasio button.

          then do a loop to the arraycolection upto it's length.

          and create the the radio button and add into vbox;

           

          ex

          <mx:Vbox id ="container"/>

           

          script:-

          privare var aa:arrayCollection =  ur arraycollection;

           

          private function addChild():void

          {

               for(var i:int=0; i<aa.length; i++)

               {

                    container.addchild(new radioButton());

               }

          }

           

          I think this hint will help u. if u get ur answer please give me points

           

          Thanks

          Niranjan Swain