Flash Script – Combobox Component

Georgina Laidlaw

Using the combobox component may seem complicated, but it’s not. Here’s how it’s done.

1. Open the components panel by pressing ctrl+f7.

2. Drag the combobox component onto the stage, and select the combobox component in Frame 1. The component’s parameters will be displayed in the Property inspector.

3. To name the componenet, type "combo" into the Property inspector Instance Name text box.

4. Make sure the Editable parameter is set to "False". This prevents users from typing in their own text.

5. The Labels parameter displays a list of values from which users can select. Click on the Labels field, then click the magnifying glass to open the Values pop-up window. Now, click the Plus (+) button to enter a new value.


6. Click in the default value field, then type "one" for the first value.

7. Click the Plus (+) button to enter the next value. Then, click in the default value field, and type "two" for the next value.

8. Repeat this process to add the values "three", "four", "five", and "six".

9. Click "Ok" to close the label box.

10. The Data parameter is optional. It’s used to specify the values associated with the items (or labels) in the box. There is no need to do that inthis case, so we won’t bother with the Data parameter this time.

11. The Row Count parameter specifies how many rows are displayed in the window. As there are six options, change the value to "6".

12. Enter a Click Handler name of "f1".


13. Now, create two dynamic text fields as shown above. I gave the first text field a variable name of "txt1", the second a name of "txt2".

14. Select the first key frame from the existing layer. Press f9 to open the actions box, and insert the following:

function f1() 
//to get the selected item label
txt1.text = combo.getSelectedItem().Label;
//to get the selected item index
txt2.text = combo.getSelectedIndex();

You’re finished — time to test the movie!