Controlling Movie Clips
In Chapter 13, we learned how to control clips using Flash 5 techniques. Here we consider the equivalent Flash 4 techniques.
Prior to Flash 5, we would execute special Movie Clip
Actions to control a movie clip. We would say “Tell
the clip named eyes to play,” using the
following:
Begin Tell Target ("eyes")
Play
End Tell TargetBut as of Flash 5, movie clips can be controlled more directly, through built-in methods. For example:
eyes.play( );
Similarly, to access the built-in properties of a movie clip prior to Flash 5, we would use explicit property-getting and property-setting commands, such as:
GetProperty ("ball", _width)
Set Property ("ball", X Scale) = 90As of Flash 5, we can retrieve and set a movie clip’s properties using the dot operator, just as we would access the properties of any object:
ball._width; ball._xscale = 90;
Prior to Flash 5, to access variables inside a movie clip, we used a colon to separate the clip name from the variable name:
Set Variable: "x" = myClip:myVariable
As of Flash 5, a variable in a movie clip is simply a property of that clip object, so we now use the dot operator to set and retrieve variable values:
myClip.myVariable = 14; x = myClip.myVariable;
Finally, prior to Flash 5, we would access nested levels of movie clips using a directory-tree metaphor of slashes and dots:
clipA/clipB/clipC ../../../clipC
Because movie clips are object-like data as of Flash 5, we can store one clip as a property of another clip. We, therefore, use the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access