Skip to main content
Participant
September 18, 2008
Question

Populating a combobox

  • September 18, 2008
  • 1 reply
  • 244 views
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.

This topic has been closed for replies.

1 reply

Inspiring
September 18, 2008
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);
}