Applied Movie Clip Examples
We’ve now learned the fundamentals of movie clip programming. Let’s put our knowledge to use by creating two very different applications, both of which exemplify the typical role of movie clips as basic content containers.
Building a Clock with Clips
In
this chapter we learned how to create
movie clips with attachMovie( ) and how to set
movie clip properties with the dot operator. With these relatively
simple tools and a little help from the Date and
Color classes, we have everything we need to
make a clock with functional hour, minute, and second hands.
First, we’ll make the face and hands of the clock with the following steps (notice that we don’t place the parts of our clock on the main Stage—our clock will be generated entirely through ActionScript):
Start a new Flash movie.
Create a movie clip symbol named
clockFacethat contains a 100-pixel-wide black circle shape.Create a movie clip symbol named
handthat contains a 50-pixel-long, vertical red line.Select the line in
hand, then choose Window → Panels → Info.Position the bottom of the line at the center of the clip by setting the line’s x-coordinate to and its y-coordinate to -50.
Now we have to export our clockFace and
hand symbols so that instances of them can be
attached dynamically to our movie:
In the Library, select the
clockFaceclip, then select Options → Linkage. The Symbol Linkage Properties dialog box appears.Select Export This Symbol.
In the Identifier box, type
clockFaceand then click OK. ...
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