Adobe Flash Professional CS3 Manuel d'utilisateur Page 79

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 527
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 78
FLASH CS3
User Guide
73
Yo u c a n u s e t h e _root alias to refer to the main Timeline of the current level. For the main Timeline, the _root alias
stands for
_level0 whentargetedbyamovieclipalsoon_level0.Foradocumentloadedinto_level5, _root is
equal to
_level5 when targeted by a movie clip also on level 5. For example, if the movie clips southcarolina and
florida are both loaded into the same level, an action called from the instance southcarolina could use the
following absolute path to target the instance
florida:
_root.eastCoast.florida
About relative paths
A relative path depends on the relationship between the controlling Timeline and the target Timeline. Relative paths
can address targets only within their own level of Flash Player. For example, you cant use a relative path in an action
on
_level0 that targets a Timeline on _level5.
In a relative path, use the keyword
this to refer to the current Timeline in the current level; use the _parent alias
to indicate the parent Timeline of the current Timeline. You can use the
_parent aliasrepeatedlytogouponelevel
in the movie clip hierarchy within the same level of Flash Player. For example,
_parent._parent controls a movie
clip up two levels in the hierarchy. The topmost Timeline at any level in Flash Player is the only Timeline with a
_parent value that is undefined.
An action in the Timeline of the instance
charleston, located one level below southcarolina, could use the
following target path to target the instance
southcarolina:
_parent
To target the instance eastCoast (one level up) from an action in charleston, you could use the following relative path:
_parent._parent
To target the instance
atlanta
from an action in the Timeline of
charleston
, you could use the following relative path:
_parent._parent.georgia.atlanta
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.
Note: Flash Lite 1.0 and 1.1 support attaching scripts only to buttons. Attaching scripts to movie clips is not supported.
Whetheryouuseanabsoluteorarelativepath,youidentifyavariableinaTimelineorapropertyofanobjectwith
adot(
.) 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,andthetimelinethatreceivestheactioniscalledthetarget 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.
Vue de la page 78
1 2 ... 74 75 76 77 78 79 80 81 82 83 84 ... 526 527

Commentaires sur ces manuels

Pas de commentaire