- Adobe Animate User Guide
- Introduction to Animate
- Animation
- Animation basics in Animate
- How to use frames and keyframes in Animate
- Frame-by-frame animation in Animate
- How to work with classic tween animation in Animate
- Brush Tool
- Motion Guide
- Motion tween and ActionScript 3.0
- About Motion Tween Animation
- Motion tween animations
- Creating a Motion tween animation
- Using property keyframes
- Animate position with a tween
- How to edit motion tweens using Motion Editor
- Editing the motion path of a tween animation
- Manipulating motion tweens
- Adding custom eases
- Creating and applying Motion presets
- Setting up animation tween spans
- Working with Motion tweens saved as XML files
- Motion tweens vs Classic tweens
- Shape tweening
- Using Bone tool animation in Animate
- Work with character rigging in Animate
- How to use mask layers in Adobe Animate
- How to work with scenes in Animate
- Interactivity
- How to create buttons with Animate
- Convert Animate projects to other document type formats
- Create and publish HTML5 Canvas documents in Animate
- Add interactivity with code snippets in Animate
- Creating custom HTML5 Components
- Using Components in HTML5 Canvas
- Creating custom Components: Examples
- Code Snippets for custom Components
- Best practices - Advertising with Animate
- Virtual Reality authoring and publishing
- Workspace and workflow
- Creating and managing Paint brushes
- Using Google fonts in HTML5 Canvas documents
- Using Creative Cloud Libraries and Adobe Animate
- Use the Stage and Tools panel for Animate
- Animate workflow and workspace
- Using web fonts in HTML5 Canvas documents
- Timelines and ActionScript
- Working with multiple timelines
- Set preferences
- Using Animate authoring panels
- Create timeline layers with Animate
- Export animations for mobile apps and game engines
- Moving and copying objects
- Templates
- Find and Replace in Animate
- Undo, redo, and the History panel
- Keyboard shortcuts
- How to use the timeline in Animate
- Creating HTML extensions
- Optimization options for Images and Animated GIFs
- Export settings for Images and GIFs
- Assets Panel in Animate
- Multimedia and Video
- Transforming and combining graphic objects in Animate
- Creating and working with symbol instances in Animate
- Image Trace
- How to use sound in Adobe Animate
- Exporting SVG files
- Create video files for use in Animate
- How to add a video in Animate
- Draw and create objects with Animate
- Reshape lines and shapes
- Strokes, fills, and gradients with Animate CC
- Working with Adobe Premiere Pro and After Effects
- Color Panels in Animate CC
- Opening Flash CS6 files with Animate
- Work with classic text in Animate
- Placing artwork into Animate
- Imported bitmaps in Animate
- 3D graphics
- Working with symbols in Animate
- Draw lines & shapes with Adobe Animate
- Work with the libraries in Animate
- Exporting Sounds
- Selecting objects in Animate CC
- Working with Illustrator AI files in Animate
- Applying blend modes
- Arranging objects
- Automating tasks with the Commands menu
- Multilanguage text
- Using camera in Animate
- Graphic filters
- Sound and ActionScript
- Drawing preferences
- Drawing with the Pen tool
- Platforms
- Convert Animate projects to other document type formats
- Custom Platform Support
- Create and publish HTML5 Canvas documents in Animate
- Creating and publishing a WebGL document
- How to package applications for AIR for iOS
- Publishing AIR for Android applications
- Publishing for Adobe AIR for desktop
- ActionScript publish settings
- Best practices - Organizing ActionScript in an application
- How to use ActionScript with Animate
- Accessibility in the Animate workspace
- Writing and managing scripts
- Enabling Support for Custom Platforms
- Custom Platform Support Overview
- Working with Custom Platform Support Plug-in
- Debugging ActionScript 3.0
- Enabling Support for Custom Platforms
- Exporting and Publishing
- How to export files from Animate CC
- OAM publishing
- Exporting SVG files
- Export graphics and videos with Animate
- Publishing AS3 documents
- Export animations for mobile apps and game engines
- Exporting Sounds
- Best practices - Tips for creating content for mobile devices
- Best practices - Video conventions
- Best practices - SWF application authoring guidelines
- Best practices - Structuring FLA files
- Best Practices to optimize FLA files for Animate
- ActionScript publish settings
- Specify publish settings for Animate
- Exporting projector files
- Export Images and Animated GIFs
- HTML publishing templates
- Working with Adobe Premiere Pro and After Effects
- Quick share and publish your animations
- Troubleshooting
With ActionScript®, you can control the Timeline at runtime. Using ActionScript allows you to create interaction and other capabilities in your FLA files that is not possible with the Timeline alone.
With ActionScript®, you can control the Timeline at runtime. Using ActionScript allows you to create interaction and other capabilities in your FLA files that is not possible with the Timeline alone.
See the discussion of timelines and ActionScript in web Help to learn about controlling the Timeline with ActionScript.
Absolute paths
An absolute path starts with the name of the level into which the document is loaded and continues through the display list until it reaches the target instance. You can also use the alias _root to refer to the topmost Timeline of the current level. For example, an action in the movie clip california that refers to the movie clip oregon could use the absolute path _root.westCoast.oregon.
The first document to open in Flash Player is loaded at level 0. You must assign each additional loaded document a level number. When you use an absolute reference in ActionScript to reference a loaded document, use the form _levelX, where X is the level number into which the document is loaded. For example, the first document that opens in Flash Player is called _level0; a document loaded into level 3 is called _level3.
To communicate between documents on different levels, you must use the level name in the target path. The following example shows how the portland instance would address the atlanta instance located in a movie clip called georgia (georgia is at the same level as oregon):
_level5.georgia.atlanta
You can use the _root alias to refer to the main Timeline of the current level. For the main Timeline, the _root alias stands for _level0 when targeted by a movie clip also on _level0. For a document loaded into _level5, _root is equal to _level5 when targeted by a movie clip also on level 5. For example, if the movie clips southcarolina and florida are both loaded into the same level, an action called from the instance southcarolina could use the following absolute path to target the instance florida:
_root.eastCoast.florida
Relative paths
A relative path depends on the relationship between the controlling Timeline and the target Timeline. Relative paths can address targets only within their own level of Flash Player. For example, you can’t use a relative path in an action on _level0 that targets a Timeline on _level5.
In a relative path, use the keyword this to refer to the current Timeline in the current level; use the _parent alias to indicate the parent Timeline of the current Timeline. You can use the _parent alias repeatedly to go up one level in the movie clip hierarchy within the same level of Flash Player. For example, _parent._parent controls a movie clip up two levels in the hierarchy. The topmost Timeline at any level in Flash Player is the only Timeline with a _parent value that is undefined.
An action in the Timeline of the instance charleston, located one level below southcarolina, could use the following target path to target the instance southcarolina:
_parent
To target the instance eastCoast (one level up) from an action in charleston, you could use the following relative path:
_parent._parent
To target the instance atlanta from an action in the Timeline of charleston, you could use the following relative path:
_parent._parent.georgia.atlanta
Relative paths are useful for reusing scripts. For example, you could attach the following script to a movie clip that magnifies its parent by 150%:
onClipEvent (load) { _parent._xscale = 150; _parent._yscale = 150; }
You can reuse this script by attaching it to any movie clip instance.
Flash Lite 1.0 and 1.1 support attaching scripts only to buttons. Attaching scripts to movie clips is not supported.
Whether you use an absolute or a relative path, you identify a variable in a Timeline or a property of an object with a dot (.) followed by the name of the variable or property. For example, the following statement sets the variable name in the instance form to the value "Gilbert":
_root.form.name = "Gilbert";
Using absolute and relative target paths
You can use ActionScript to send messages from one timeline to another. The timeline that contains the action is called the controlling timeline, and the timeline that receives the action is called the target timeline. For example, there could be an action on the last frame of one timeline that tells another timeline to play. To refer to a target timeline, you must use a target path, which indicates the location of a movie clip in the display list.
The following example shows the hierarchy of a document named westCoast on level 0, which contains three movie clips: california, oregon, and washington. Each of these movie clips in turn contains two movie clips.
_level0 westCoast california sanfrancisco bakersfield oregon portland ashland washington olympia ellensburg
As on a web server, each timeline in Animate can be addressed in two ways: with an absolute path or with a relative path. The absolute path of an instance is always a full path from a level name, regardless of which timeline calls the action; for example, the absolute path to the instance california is _level0.westCoast.california. A relative path is different when called from different locations; for example, the relative path to california from sanfrancisco is _parent, but from portland, it’s _parent._parent.california.
Specify target paths
To control a movie clip, loaded SWF file, or button, you must specify a target path. You can specify it manually, or by using the Insert Target Path dialog box, or by creating an expression that evaluates to a target path. To specify a target path for a movie clip or button, you must assign an instance name to the movie clip or button. A loaded document doesn’t require an instance name, because you use its level number as an instance name (for example, _level5).
Assign an instance name to a movie clip or button
-
Select a movie clip or button on the Stage.
-
Enter an instance name in the Property inspector.
Specify a target path using the Insert Target Path dialog box
-
Select the movie clip, frame, or button instance to which you want to assign the action.
This becomes the controlling Timeline.
-
In the Actions panel (Window > Actions), go to the Actions toolbox on the left, and select an action or method that requires a target path.
-
Click the parameter box or location in the script where you want to insert the target path.
-
Click the Insert Target Path button above the Script pane.
-
Select Absolute or Relative for the target path mode.
-
Select a movie clip in the Insert Target Path display list, and click OK.
Specify a target path manually
-
Select the movie clip, frame, or button instance to which you want to assign the action.
This becomes the controlling Timeline.
-
In the Actions panel (Window > Actions), go to the Actions toolbox on the left, and select an action or method that requires a target path.
-
Click the parameter box or location in the script where you want to insert the target path.
-
Enter an absolute or relative target path in the Actions panel.
Use an expression as a target path
-
Select the movie clip, frame, or button instance to which you want to assign the action.
This becomes the controlling Timeline.
-
In the Actions panel (Window > Actions), go to the Actions toolbox on the left, and select an action or method that requires a target path.
-
Do one of the following:
Enter an expression that evaluates to a target path in a parameter box.
Click to place the insertion point in the script. Then, in the Functions category of the Actions toolbox, double-click the targetPath function. The targetPath function converts a reference to a movie clip into a string.
Click to place the insertion point in the script. Then, in the Functions category of the Actions toolbox, select the eval function. The eval function converts a string to a movie clip reference that can be used to call methods such as play.
The following script assigns the value 1 to the variable i. It then uses the eval function to create a reference to a movie clip instance and assigns it to the variable x. The variable x is now a reference to a movie clip instance and can call the MovieClip object methods.
i = 1; x = eval("mc"+i); x.play(); // this is equivalent to mc1.play();You can also use the eval function to call methods directly, as shown in the following example:
eval("mc" + i).play();