Working with Movie Clips and Buttons > About multiple Timelines > Writing target paths |
![]() ![]() ![]() |
Writing target paths
To control a movie clip, loaded movie, or button, you must specify a target path. Before you can specify a target path to a movie clip or button, you must assign it an instance name. A loaded movie doesn't require an instance name, because you use its level number as an instance name (for example, _level5
).
You can specify a target path in several different ways:
![]() |
Use the Insert Target Path button (and dialog box) in the Actions panel. |
![]() |
Enter the target path manually. |
![]() |
Create an expression that evaluates to a target path. You can use the built-in functions |
To assign an instance name:
1 |
Select a movie clip or button on the Stage. |
2 |
Enter an instance name in the Property inspector. |
To insert 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 will be the controlling Timeline. |
|
2 |
Choose Window > Actions to display the Actions panel if it's not already open. |
3 |
In the Actions toolbox (at the left of the panel), choose an action or method that requires a target path. |
4 |
Click the parameter box or location in the script where you want to insert the target path. |
5 |
Click the Insert Target Path button above the Script pane. |
6 |
In the Insert Target Path dialog box, choose a syntax: Dots (the default) or Slashes. |
7 |
Choose Absolute or Relative for the target path mode. |
8 |
Select a movie clip in the Insert Target Path display list. |
9 |
Click OK. |
To insert a target path manually:
Follow steps 1-4 above and enter an absolute or relative target path in the Actions panel.
To use an expression as a target path:
1 |
Follow steps 1-3 above. |
2 |
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 |
The |
|
![]() |
Click to place the insertion point in the script. Then, in the Functions category of the Actions toolbox, choose the |
The |
|
The following script assigns the value 1 to the variable |
|
i = 1; x = eval("mc"+i); x.play(); // this is equivalent to mc1.play(); |
|
You can also use the |
|
eval("mc" + i).play(); |
![]() ![]() ![]() |