Add new snippets to the code snippets panel – Adobe Flash Professional CC 2014 v.13.0 User Manual
Page 38

(Flash CS5.5) Add a code snippet to an object or Timeline frame
To add an action that affects an object or the playhead:
1. Select the snippet you want to apply in the Code Snippets panel (Window > Code Snippets).
2. To display a description of the snippet, click the Show Description button that appears to the right of the selected snippet.
3. To display the code within the snippet, click the Show Code button to the right of the snippet.
4. If the snippet contains the text “instance_name_here”, drag from that text to the instance on the Stage that you want to the code to control.
To drag-and-drop, the symbol instance must be a movie clip or a button.
If the instance does not yet have a name, a dialog box appears to allow you to enter a name for the instance.
You can also click the text and enter the instance name directly in the code. Use this method of you are working with a shape or graphic
symbol instance.
5. If the snippet contains other colored text, select the text and enter the correct information according to the instructions inside the code
snippet.
6. When you finish editing the code snippet, click the Insert button.
Flash adds the code to the Actions layer. If no Actions layer exists, Flash creates one.
If you selected an object on the Stage, Flash adds the snippet to the Actions panel in the frames containing the selected object.
If you selected a Timeline frame, Flash adds the snippet to the Actions layer in just that frame.
7. (Optional) To view the inserted code, open the Actions panel (Window > Actions).
Add new snippets to the Code Snippets panel
You can add new code snippets to the Code Snippets panel in two ways:
Enter a snippet in the Create New Code Snippet dialog box.
Import a code snippet XML file.
To use the Create New Code Snippet dialog box:
1. In the Code Snippets panel, choose Create New Code Snippet from the panel menu.
2. In the dialog box, Enter the Title, Tool tip text, and JavaScript or ActionScript 3.0 code for your snippet.
You can add any code that is currently selected in the Actions panel by clicking the Auto-Fill button.
3. Select the Automatically replace instance_name_here check box if your code includes the string “instance_name_here” and you want Flash
to replace it with the correct instance name when the snippet is applied.
Flash adds the new snippet to the Code Snippets panel in a folder called Custom.
To import a code snippet in XML format:
1. In the Code Snippets panel, choose Import Code Snippets XML from the panel menu.
2. Select the XML file you want to import and click Open
To see the correct XML format for code snippets, choose Edit Code Snippets XML from the panel menu.
To delete a code snippet, right-click the snippet in the panel and choose Delete Code Snippet from the context menu.
31