EasyManua.ls Logo

MACROMEDIA FLASH 8-USING FLASH - Page 41

MACROMEDIA FLASH 8-USING FLASH
678 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Using absolute and relative target paths 41
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.
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";
Writing target paths
To control a movie clip, loaded movie, or button, you must specify a target path. In order 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 doesnt require an instance name because you use its
level number as an instance name (for example,
_level5).
To specify a target path, do one of the following:
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
targetPath and eval.
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 becomes the controlling Timeline.
2. Select Window > Actions to display the Actions panel if it’s not already open.
NOTE
Flash Lite 1.0 and 1.1 support attaching scripts only to buttons. Attaching scripts to movie
clips is not supported..

Table of Contents

Related product manuals