About Script Assist
About Script Assist
If you are uncomfortable writing ActionScript code or syntax, you might want to try using Script Assist mode in the Actions panel (Window > Actions). Script Assist is useful for creating scripts by making selections in the Actions panel and filling in text fields to automatically create statements in the Script pane. While you typically won’t use Script Assist for large applications, it is very useful for adding interactivity to your Flash applications, mocking up prototypes, and more.
Script Assist lets you build scripts by selecting items from the Actions toolbox, the list on the left side of the Actions panel. You can also select actions from the Add (+) pop-up menu. The Actions toolbox separates items into categories such as actions, properties, and objects, and also provides an index category that lists all items alphabetically. When you click an item once, its description appears at the upper right of the panel. When you double-click an item, it adds the item to the scrolling list on the right side of the panel in the Script pane.
In Script Assist mode, you can add, delete, or change the order of statements in the Script pane; you can also enter parameters for actions in text boxes above the Script pane. You can also use the standard Actions panel features while in Script Assist mode: you can find and replace text, view script line numbers, and pin a script—that is, keep a script in the Script pane when you click away from the object or frame.
To add an action to a Flash document, you must attach it to a button or movie clip, or to a frame in the Timeline. The Actions panel lets you select, drag and drop, rearrange, and delete actions.
To write ActionScript using Script Assist:
- Select Window > Actions.
The Actions panel appears.
- Click the Script Assist button,
The Actions panel enters Script Assist mode.
Note: If the Actions panel contains ActionScript code when you click the Script Assist button, Flash validates the existing code. If there are errors in the code, you will not be able to use Script Assist until you fix (or comment out) the current code selection.
When Script Assist is enabled, the Actions panel user interface and behaviors change in the following ways:
- The Add (+) button functions differently in Script Assist mode. When the focus is on the Actions toolbox, it adds the selection after the currently selected text block. If the focus is in the Script pane, the selection is added to that text block.
- The Remove (-) button lets you remove the current selection in the Script pane.
- The Up and Down Arrow buttons let you move the current selection in the Script pane forward or backward within the code.
- The Check Syntax, Auto Format, Show Code Hint, and Debug Options buttons and menu items normally visible in the Actions panel are disabled, as they do not apply to Script Assist mode.
- The Insert Target button lets you select a movie clip, button, text field, or video object on the stage (or nested within an object on the stage) as the target for an action. The button is disabled unless you are editing a field in the Edit pane that expects such a target.
The Flash documentation contains hands-on examples that show you how to use Script Assist. For an example of writing a script using Script Assist, see Using Flash > Writing ActionScript with Script Assist > Creating a startDrag/stopDrag Event Using Script Assist. For a tutorial that shows you how to build a small application using Script Assist, see Flash Tutorials > ActionScript: Use Script Assist Mode.