1 Reply Latest reply on Sep 18, 2008 8:48 AM by Newsgroup_User

    Populating a combobox

    cacososa
      Hi. I'm trying to populate a combobox based on a string.
      I get my data from an asp page therefore my string contains the following
      Region = "Region1-23,Region2-44,Region3-53"
      How can I populate a combobox using this string??? I would like as label Region1 and as data the number next to it.

      Any help would be greatly appreciated.

        • 1. Re: Populating a combobox
          Level 7
          var Region:String = "Region1-23,Region2-44,Region3-53";
          var Regions:Array = Region.split(",");

          for(var idx:Number=0; idx<Regions.length; idx++)
          {
          var itemData:Array = Regions[idx].split("-");
          myComboBox.addItem(itemData[0], itemData.length>1 ? itemData[1] : null);
          }