Using A ComboBox in Flex
Line Break
Author: Arjan (34 Articles) - Author Website
Arjan is a SAP Consultant specialized in ABAP and Front End development techniques like Web Dynpro, Adobe Interactive Forms, Flex and AIR. In his free time he likes to create examples for Flex-Blog and other applications using Flex, AIR and PHP. Other hobbies are movies and music. He is also the co-owner of Flex-Blog.com.
The ComboBox or DropDown in other development environments, is a very useful input element. The great advantage of it is the fact that you can determine the values that a user can choose.
The items that are choosable in a combo box can be both static as dynamic. The following examples show you how to use both approaches.
First of all, a Flex ComboBox that is filled in code using static values.
Of course, you probably understand that this is not that way to feed your application with data, it would require recoding of the application if we want to add a product (e.g. Product Five).
So, how can we do this dynamically? Using an XMLList and some call to an external file or database using some language (PHP, ASP, JAVA…).
The following example shows you how to use an external XML file as datasource. When connecting to a server, the approach would be the same.
I also added a label to show the number of items in stock for the selected product. The label refers to the selected item of the ComboBox to get the correct number. Check it out, use right mouseclick and view source to see the sourcecode.
Related posts:
- Images in DataGrid depending on data
- Using the Repeater in Flex
- Using ASDoc as an External Tool in Flash Builder 4


