14. Select Frame 1 in the Timeline and (Medical web site)
14. Select Frame 1 in the Timeline and enter the following code in the Script pane of the Actions panel: myEvent = new Object(); myForm = new Object(); myForm.click = function(myEvent){ myInfo.text = myEvent.target.selection.data; } myRadioGroup.addEventListener( click ,myForm); You can replace myForm, myEvent, myInfo, and myRadioGroup with any names that you like. myInfo in this example is the name of the dynamic text field that we mention in Step 12, and myRadioGroup is the group name of your radio buttons. Lines 1 and 2 of the preceding code create new little bundles of methods and properties named myEvent and myForm. Line 6 adds an event listener to myForm so that when you select one of the radio buttons in myRadioGroup, the code in Lines 3, 4, and 5 sets the text of the dynamic text field to whatever is in the data parameter of the radio button that you click. The second line of code shows an example of how to change the contents of the dynamic text box that we describe in Step 11, but you can replace this line with other ActionScript code to do something else in your movie to respond to changes in which radio button is selected. For example, if you want to set the text of the dynamic text field to be the label of the radio button that you click, replace this line: myInfo.text = myEvent.target.selection.data; with this line: myInfo.text = myEvent.target.selection.label; For radio buttons, the Property inspector has two tabs in the upper-right corner one tab for properties and one tab for parameters. If you have a radio button selected but its parameters don t show on the Property inspector, you probably clicked the Properties tab by accident. Click to select the Parameters tab in the upper-right corner of the Property inspector; now it should display the radio button parameters. When you look at the preceding code, on some deep level you may be thinking, Huh? But it s possible to do a lot of coding in Flash without getting a PhD in ActionScriptology first. You can accomplish a lot by copying existing code, playing with it, and observing the effect. 260 Part V: The Movie and the Web
In case you need quality webspace to host and run your web applications, try our personal web hosting services.