39542 Web Animation

Spring 2007 Semester | Mondays 6:15 p.m. to 9:05 p.m.
Professor Rich Hauck
Department of Art
The City College of New York
richardhauck [at] hotmail

Class 7

Timeline-Based Preloader

This is an example of a preloader placed into the _root timeline. The _root timeline loops to achieve the animated preloader effect, and the photograph is embedded into the FLA.

Download preloader_01 (zip)

Timeline-Based Preloader Encapsulated into a Reusable MovieClip

This is an example of a preloader placed into a MovieClip. By placing the preloader into a MovieClip, the code and the graphics are reusable and easier to transfer to different files. Here, the SWF is loading an external JPEG image and is using the onEnterFrame() function to create the preloader animation.

Here's the code on the _root:

// first, create an empty movie clip to hold the picture or external SWF
this.createEmptyMovieClip("holder_mc", 1);
// next, we load the external item into this Flash Movie
holder_mc.loadMovie("../lib/img/week7/ccny.jpg");
// last, we attach the preloader
this.attachMovie("preloader_mc", "preloader_mc", 2, {_x:225, _y:181});
			  

Download preloader_02 (zip)

Attaching a Movie

Download attachCircle (zip)

The attachMovie() method allows you to tell Flash to "attach" a MovieClip from Flash's library onto the Stage at runtime (runtime means while the SWF is running, rather than when you are authoring the FLA file). Check the file to see how to attach the movie, as well as remove it, as is shown in the above file.

To attach a MovieClip:

While naming your new symbol, click the "Export for ActionScript" checkbox, which will automatically choose "Export in first frame" (if you don't see this screen while converting to symbol, try clicking the "Advanced" button, which is seen here toggled to "Basic").

Already have a symbol created? No problem. Simply right-click or control-click (MAC) the symbol in the library and either choose "Properties" or "Linkage" to bring up the window above.

linkage

After naming your MovieClip and setting a Linkage Identifier (the "handle" for ActionScript), you should be able to attach your MovieClip with a variation of the code below. See the file for more details.

For more explanation, don't forget to view Flash Help on attachMovie().

A Sample Site Map

Here's an example of a basic site map (PDF). This example was done in OmniGraffle, however, you can build something similar using Adobe Illustrator if OmniGraffle isn't on your computer.