Using absolute and relative target paths, Specify target paths – Adobe Flash Professional CC 2014 v.13.0 User Manual
Page 768
Note: 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 Flash Professional 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
1. Select a movie clip or button on the Stage.
2. Enter an instance name in the Property inspector.
Specify a target path using the Insert Target Path dialog box
1. Select the movie clip, frame, or button instance to which you want to assign the action.
This becomes the controlling Timeline.
2. 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.
3. Click the parameter box or location in the script where you want to insert the target path.
4. Click the Insert Target Path button
above the Script pane.
5. Select Absolute or Relative for the target path mode.
6. Select a movie clip in the Insert Target Path display list, and click OK.
Specify a target path manually
1. Select the movie clip, frame, or button instance to which you want to assign the action.
This becomes the controlling Timeline.
2. 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.
3. Click the parameter box or location in the script where you want to insert the target path.
4. Enter an absolute or relative target path in the Actions panel.
761