Now that the interface is laid out, we can write the script that accesses the data in the radio group. All four radio buttons belong to the same group, so only one of them can be selected at a time. To find out which one the user selected, we simply need to access the data of the selected item in the radio group. ActionScript makes this easy, as you will soon see.
1. | Click Frame 1 of the actions layer, and press F9 to open the Actions panel . |
The script you wrote earlier is still there.
2. | Below the existing code, add the following code : /**************** When the Next Question button is clicked: * Goes to the next screen ****************/ q1_button.onRelease = function() { gotoAndStop("q2_label"); }; |
You've already seen several scripts just like this, so it should be familiar to you by now. Of course, it doesn't actually access any of the data.
3. | Add the following code just above the gotoAndStop() line. Test the movie, make a selection, and click Next Question . trace(q1_radio.selection.data); |