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
Before you begin
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.
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.
Add a code snippet to an object or Timeline frame
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.
Add new snippets to the Code Snippets panel
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.