I am trying to do something similar to the code below but in Flex. Code below is .Net. Any ideas?`
<asp:dropdownlist id="lstBufferDistance" style="Z-INDEX: 125; LEFT: 488px; POSITION: absolute; TOP: 112px"
tabIndex="4" runat="server" Width="72px" Height="16px">
<asp:ListItem Value="200">200 ft</asp:ListItem>
<asp:ListItem Value="500" Selected="True">500 ft</asp:ListItem>
<asp:ListItem Value="1000">1000 ft</asp:ListItem>
<asp:ListItem Value="1500">1500 ft</asp:ListItem>
<asp:ListItem Value="5280">1 Mile</asp:ListItem>
</asp:dropdownlist>`
I don’t know .NET, but it looks like that code is a drop down list with a dataProvider. Something like this should work:
So, this uses the Spark DropDownList. It creates a dataProvider in MXML which is made up of generic objects. The generic objects have a property named label; which is used by the DropDownList as the display field for each item. The generic objects can also have other properties–in this case value–which can represent some other data about the item.
Normally in “real world” apps you wouldn’t use a generic object for a dataProvider, but instead you’d create a custom class.
I used the selectedIndex property to set a default value to the 2nd item in the list.