Flash 8: Projects for Learning Animation and Interactivity (OReilly Digital Studio)

3.8. Publishing Your Movie

The animation is done, but your work cannot be shown outside the Flash authoring environment until you publish the movie.

Publishing a Flash movie is the act of exporting the completed version of a .fla file as another file type. The .fla format is used only for editing within the Flash application; it is too bloated with excess information (and too unprotected) to be appropriate for distribution. When you publish Flash content for the Web (for use with the Flash Player browser plug-in), the .fla file is compiled into the aforementioned self-contained .swf file format. You can publish other file formats too, some of which will be discussed later in this book.

Flash can also automatically create an HTML page in which to display your SWF file. Users don't ordinarily browse directly to the URL of a SWF file. Instead, developers typically publish an HTML file in which the SWF file is embedded (using the HTML <object> and <embed> tags).

Publish your movie and see how it performs:

  1. With the Stage selected, choose the Settings button in the Properties panel. The Publish Settings dialog box opens to the Flash tab, as shown in Figure 3-16.

  2. Your current movie will play in older versions of the Flash Player, but realistically, most people use at least Flash Player 5 or 6. In fact, as of June 2005, Macromedia doesn't even track installed versions prior to v5 (see http://www.macromedia.com/software/player_census/flashplayer/version_penetration.html for more information). Publishing using the minimum required version helps improve compatibility for your files, but there's no compelling reason to date back prior to Flash 5. Therefore, under the Flash tab, choose Flash Player 5 from the Version drop-down list. Be sure to set the version back to a more current player, though, when creating Flash movies that use features not supported in earlier versions.

  3. Once you've specified the desired publishing settings, click Publish to publish your movie. This generates the SWF and HTML files, but doesn't literally publish the file on the Web. (In this case, "publish your movie" effectively means "generate a file," rather than the more traditional meaning of "make the file publicly available.") Both files will automatically be placed in the same folder as the .fla file, unless you specify otherwise in the Publish settings.

  4. In a web browser, try the HTML file you just created. If you have the Flash plug-in installed, you should have no problem enjoying the results of your work.

  5. Save your work. You're all done for now.

Figure 3-16. The Publish Settings dialog box

Semicolon;

If you've been investigating Flash scripting on your own, you may have noticed that some scripts include a semicolon at the end of each line, and some don't. This is because the current version of ActionScript does not technically require the semicolon at the end of each line, and will compile correctly without it. Officially, the semicolon is required only when including more than one consecutive instruction in a single line, but that won't be covered in this book.

However, as a best practice, you should include the semicolon at the end of each instruction line of ActionScript. Although not required, it makes the code easier to read and will help establish good habits. This will make it much easier for you to migrate to other circumstances and languages where an ending semicolon is required, such as Cascading Style Sheets (CSS) and PHP.

3.8.1. What's Next?

Mission accomplished! You now have an animation in SWF format ready to be posted on the Web.

You've already learned the basics of controlling the speed of an animation (by adjusting the frame rate or the number of frames over which the animation occurs). The pacing of an animation is key to its success, so keep that in mind as you begin new projects. A slow-paced ad for a high-speed Internet connection service, for example, would not convey the desired message to the user. Subconsciously, the user would associate a slow ad with a slow Internet connection. Therefore, you'd want to use a slow-paced animation when discussing the competing products (such as dial-up connections), and use a fast-paced animation to dramatize the speed of the high-speed Internet connection.

To practice what you've learned, try modifying other properties of the animation you created. Can you start with invisible boxes and fade them in? Can you animate the text using different starting points, so the text moves in different directions? Finally, try changing the pace of the animation.

Motion effects can convey a sense of depth in Flash animationssomething you may want to strive for in your own work. In the real world, objects close to the viewer appear to move more quickly than objects that are far away. How might you use this fact to make, say, an animation of falling snow appear more realistic?

If you want the user to be able to replay your animation, you can add a button to the end that will restart the file from frame 1, as you'll soon see.

In the next chapter, you'll take a look at several types of buttons and simple interactivity. You'll learn:

  • How to pick up ActionScript quickly with the Script Assist mode

  • A little more about basic ActionScript structure

  • How to use components and behaviors

  • How to use buttons for navigation

Категории