Adding and Scripting a ComboBox Component
The first question is complete; now you just have to worry about the next four. Actually, it's not as bad as it appears, because two have been done already (questions 4 and 5), and the other two are remarkably similar to the question you just did.
1. | Click Frame 10 of the forms layer. From the Components panel, drag in an instance of the ComboBox component. Use the Property inspector to give it an instance name of q2_combo . |
The ComboBox component is superficially quite different from the RadioButton component, but under the surface its functionality is quite similar.[View full size image]

2. | In the Parameters tab of the Property inspector, double-click the Data field. In the Values dialog, click the + button and replace the default text with 999 . Repeat this process four more times to create the values a, b, c, and d. Click OK . |
You're creating the data values that will be submitted when the user clicks the Next Question button for this screen.

3. | Double-click the Labels field and add five labels. The first value is three spaces, the next four are Cassius, Phlegyas, Brutus , and Judas . Click OK. |
You're populating the items that will appear in the ComboBox. Notice that the five labels are correlated to five data values.Four of these label/data combinations are straightforward, but one might seem odd. The one with three spaces for a label and a data value of 999 will be the default option, and you'll write the validation script so that if the data entered by the user is 999, you know the user didn't make a selection. You can't test for undefined, like you did with the radio buttons, because a ComboBox always returns a value, even if the user didn't specify one. The value that's returned is the first item by default, so by making the first item a dummy item with a dummy value you can still verify that the user made a selection.

4. | With Frame 10 of the forms layer still selected, drag an instance of the Button component to the stage. Give it an instance name of q2_button . Change its label to Next Question . |
Put the instance near the bottom of the stage. Remember that the ComboBox is a pop-up menu, and will expand in size when the user clicks it. By placing this button near the bottom, you leave room for the ComboBox to operate normally.[View full size image]

5. | In Frame 10 of the actions layer, in the Actions panel, enter the following script (optionally, you can copy the relevant portion of the script from Frame 1 and customize it). Place it at the end after the existing code .q2_button.onRelease = function() { |
This script should look quite familiar. You're merely replacing a couple instance names (instead of q1_button, you now use q2_button; likewise, you replace q1_radio with q2_combo). In addition, the correct answer is now "b," rather than "d." The only other difference is that instead of accessing the data with selection.data, you use selectedItem.data. Macromedia used slightly different method names for equivalent functionalities in the two types of components (RadioButtons and ComboBoxes).[View full size image]

6. | Test the movie . |
It's always a good idea to make sure things work before moving to the next task. If you choose the fourth radio button and the second item ("Phlegyas") in the ComboBox, you should end up with a score of 2.