In previous tasks, you modified the parameters of an action as you used the Behaviors panel and Script Assist to create a script. You can use the same assistants to edit those scripts in the future. To edit a behavior-based script using the Behaviors panel 1. | Open a document containing an object (or keyframe) with an attached behavior.
For example, open a document containing a button with a behavior that sends the movie to a new frame.
| 2. | Access the Behaviors and Actions panels.
| 3. | Select the object (or keyframe) whose behavior you want to modify.
The Behaviors panel displays the behavior assigned to the object (or keyframe); the script for this behavior appears in the Script pane of the Actions panel.
| 4. | To change the triggering event, click it in the Event column of the Behaviors panel.
A menu of events appears from which you can choose a new one (see "Changing Events," earlier in this chapter).
| 5. | To change the parameters of a behavior, in the Action column of the Behaviors panel, double-click the action.
The dialog containing the parameters for the behavior appears. You can change any of the parameters. In a Goto and Stop at frame or label behavior, for example, you can change the target movie clip, the pathname style, and/or the frame number (Figure 13.41).
Figure 13.41. The goto action for the selected button symbol in this movie was created with a behavior (note the button icon at the top of the panel). To modify the behavior, double-click the action name in the Action column (top). The dialog containing parameters for that action appears (bottom). Changes you make to these parameters appear in the Script pane after you close the dialog. | 6. | Click OK.
Flash updates the script.
| To edit a script using Script Assist 1. | Continuing with the document in the preceding task, access the Actions panel.
The script for the selected button appears in the Script pane.
| 2. | Activate Script Assist mode.
| 3. | In the Script pane, click the line containing the goto action.
Fields named Object and Parameters appear in the Script Assist window (Figure 13.42). These helpers are more cryptic than what you see in the parameters dialog for the behavior script in step 5 of the preceding task and more cryptic than what you'd see if you were creating a goto script from scratch using Script Assist. That's because the behavior uses a different technique to create the script than Script Assist does. When Script Assist works with that line of script, it assumes you must understand the ideas behind it.
Figure 13.42. The Script Assist window displays parameters for a selected a line of script. Changing these parameters modifies the script. (Note that Script Assist gives you minimal direction. Script Assist gives you the Object field for entering the target path; Behaviors asks you to choose the movie clip. Where Script Assist displays a Parameters field; Behaviors describes what you must enter into the field (the frame number or label). | 4. | In the Script Assist window, enter new values for the parameters. For this example, do the following:
- In the Object field, enter the pathname of the target object. To get more assistance, select the text in the Object field and click the Insert Target Path button in the Script Assist toolbar; in the Insert Target Path dialog that appears, select the target object and a pathname style, and then click OK (Figure 13.43).
Figure 13.43. When you use Script Assist to edit a script created by behaviors, you get less direction. To get help entering the target path for the scripted button, select the Object field, and then click the Insert Target Path button in the Script Assist toolbar (top). Flash opens the Insert Target Path dialog where you can choose your target visually (bottom). - In the Parameters field, enter a new frame number.
Flash updates the script. This kind of minor editing doesn't break the link to the Behaviors panel. If you double-click the Action column for this goto action, you'll see your new target object and frame number in the parameters dialog.
| Tips If you used Script Assist originally to set up the same goto action for a button, clicking the goto line in the Script pane displays the same parameters you used in the original setup. It's best to begin your edits using the same method you used to create the script initially. If you used the Behaviors panel, start there; if you used Script Assist, start there. You can use Script Assist to help you edit scripts created using behaviors, but doing so may break the link to the Behaviors panel. As you become more familiar with ActionScript scripting, you can also type directly in the Script Pane to edit scripts, but doing so may make it impossible to use Script Assist or behaviors on that script from then on. Flash displays a warning dialog and puts error messages in the Output panel if Script Assist is unable to work with your script. |