The Code Snippets panel is designed to make it easy for non-programmers to start using simple JavaScript and ActionScript 3.0 quickly. It lets you add code to your FLA file to enable common functionality. Using the Code Snippets panel does not require knowledge of JavaScript or ActionScript 3.0.
With the Code Snippets panel, you can:
Add code that affects the behavior of an object on the Stage
Add code that controls the movement of the playhead in the Timeline
(CS5.5 only) - Add code that allows touchscreen user-interaction
Add new code snippets that you create to the panel
Using the code snippets included with Animate is also a good way to begin learning JavaScript or ActionScript 3.0. By looking at the code in the snippets and following the snippet instructions, you can begin understanding code structure and vocabulary.

When working with the Code Snippets panel, it is important to understand these fundamentals of Animate:
Many of the code snippets require you to customize a few items in the code. In Animate, you can do this in the Actions panel. Each snippet contains specific instructions for this task.
All of the included code snippets are either JavaScript or ActionScript 3.0.
Some snippets affect the behavior of an object, allowing it to be clicked or causing it to move or disappear. You apply these snippets to the object on the Stage.
Some snippets cause an action to occur immediately when the playhead enters the frame that contains the snippet. You apply these snippets to a Timeline frame.
When you apply a code snippet, the code is added to the current frame of the Actions layer in the Timeline. If you have not created an Actions layer yourself, Animate adds one above all other layers in the Timeline.
For ActionScript to control an object on the Stage, the object must have an instance name assigned in the Property inspector.
You can click the Show Description and Show Code buttons that appear when you select a snippet in the panel.
-
Select an object on the Stage or a frame in the Timeline.
If you select an object that is not a symbol instance, Animate converts the object to a movie clip symbol when you apply the snippet.
If you select an object that does not already have an instance name, Animate adds one when you apply the snippet.
-
In the Code Snippets panel (Window > Code Snippets), double-click the snippet you want to apply.
If you selected an object on the stage, Animate adds the snippet to the Actions panel in the frames containing the selected object.
If you selected a Timeline frame, Animate adds the snippet to just that frame.

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.