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.

Use an expression as a target path

  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. 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.

      0i = 1;
      0x = eval("mc"+i);
      0x.play();
      0// this is equivalent
      to mc1.play();

      You can also use the eval function to call methods directly, as shown in the following example:

      0eval("mc" + i).play();

  This page on the Web