Understanding the ActionScript Language > Writing a target path |
Writing a target path
To use an action to control a movie clip or loaded movie, you must specify its name and its address, called a target path.
In ActionScript you identify a movie clip by its instance name. For example, in the following statement, the _alpha property of the movie clip named star is set to 50% visibility:
star._alpha = 50;
To give a movie clip an instance name:
1 |
Select the movie clip on the Stage. |
2 |
Enter an instance name in the Property inspector. |
To identify a loaded movie:
Use _levelX, where X is the level number specified in the loadMovie action that loaded the movie.
For example, a movie loaded into level 5 has the target path _level5. In the following example, a movie is loaded into level 5 and its visibility is set to false:
onClipEvent(load) {
loadMovieNum("myMovie.swf", 5);
}
onClipEvent(enterFrame) {
_level5._visible = false;
}
To enter a movie's target path:
In the Actions panel (Window > Actions), click the Insert Target Path button and select a movie clip from the list that appears.
For more information about writing target paths, see Working with Movie Clips and Buttons.