Building the Quiz Interface with Components
In this task, you'll return to Flash and build the quiz interface using Flash components. When you're finished, the first screen of the quiz will look complete. It won't work yet (that will require a little ActionScript), but at least it will look right.
1. | Return to Flash and open dante_quiz.fla, if necessary . |
You can close Dreamweaver now. You won't need it for this lesson.
2. | Click Frame 1 of the form layer. Open the Library panel (Window > Library). Press and drag an instance of the radio button onto the stage, and position it below the question . |
[View full size image]


3. | With the radio button still selected, in the Parameters tab of the Property inspector (which should be activated automatically), click in the Label field and type It's not. It is a sin of weakness . |
Press Enter/Return to apply the value. This text string now appears beside the radio button, where it previously said "radio button." When you label each radio button, your user knows what she or he is selecting.Notice that part of the label is truncated. The label area beside the button is wide enough to accommodate the words "radio button," but does not accommodate the full text string.[View full size image]

4. | Select the RadioButton component instance and, using the Free Transform tool, drag the box to the right to make the entire label visible . |
Customization does not affect the functionality of the component. It just makes the full label readable for the user.[View full size image]

5. | With the radio button still selected, set the Data to a and the Group Name to q1_radio in the Parameters tab of the Property inspector . |
The Group Name setting is critical; this is the name of the radio group, and the name under which the actual data will be stored. The Data setting is also vital; the value you enter is the value that will be stored if the user selects this particular button. Therefore, if the user selects this radio button, Flash will know that the value of q1_radio is a. If the user selects a different radio button (although you haven't created it yet), Flash will know that the value of q1_radio is b, c, or whatever the Data setting is for that button.This radio button is now good to go. Of course, by itself it doesn't make much of a group.[View full size image]

6. | Copy the radio button and paste three copies of it, one below the other. Change the labels and data values as follows. All should have the Group Name set to q1_radio. When you're finished, adjust the length of the label areas to accommodate the long labels . |
Label: Suicide is cruel towards one's relatives. Data: b .Label: Because suicides want to hurt God. Data: c .Label: Suicides' souls are so poisoned that they cast away their bodies. Data: d .In this step you individualized each of the buttons, both for the user (by changing the labels) and for the computer (by changing the Data values). In spite of this individuation, the buttons all still belong to the same radio button group, q1_radio.Remember not to change the Group Name; all four should be q1_radio.[View full size image]

7. | Drag an instance of the Button component onto the stage . |
<form> element in Flash, as there is i227. And remember that th218 <form> element has an action attribute that lets you specify what the Submit button should do (such as POST the information to another page).Because Flash doesn't see these elements as a part of a larger form, there's no way to tell it unilaterally what to do with all of this data. Telling Flash to do something with the data requires ActionScript, which you'll write later. Clicking this Submit button will serve as the event that triggers a custom function, much like the ones you've written throughout this book, all of which used the following syntax:
myButton_btn.onRelease = function() {
// some code here;
};
8. | With the button still selected, enter Next Question as its label. Give it an instance name of q1_button . |
[View full size image]
