Hands On 7: Creating an Animated 3D Flash Preloader

Overview

One of Flash's greatest strengths is its ability to deliver high-quality audio and animation in a single, compact file. This characteristic makes Flash ideally suited for the Internet and other applications in which bandwidth is a major concern. What is often forgotten, though, is that Flash can also be distributed in ways that are not limited by download-time or plug-in issues.

One of the best ways to distribute your Flash movies is to pass them to your audience on a CD-ROM as stand-alone or self-contained applications. In this format, Flash can either rely on the stand-alone Flash Player or be completely independent and run on both Macintosh and Windows platforms without additional software. Plus, with the capacity of a CD-ROM, you are able to deliver a greater amount of information without the concerns of bandwidth that you encounter on the Web.

While no single delivery method can do it all, you will find that each has its particular advantages and allows you to distribute your movies in new ways that open the door to many new possibilities.

 

Stand-Alone Flash Files

Although Flash most commonly appears on the Internet in the context of a website, don't forget that there are other options that help you to reach your audience. Flash can produce two types of stand-alone movies that enable you to share your work without requiring that your audience go to the Web. The first is a standard SWF file. If your audience has the stand-alone Flash Player application, they will be able to see your movie without the aid of a web browser. The other type of stand-alone movie is a self-contained Flash projector. This is a self-running application that allows your movie to run on any computer, whether the Flash Player is installed or not.

One of the best advantages of both stand-alone options is that you can create all your movies so that they will run on all platforms. Regardless of the operating system that you use to run Flash, you'll be able to create final files that match the playback capabilities of your audience. This characteristic makes Flash one of the most portable multimedia applications currently available.

Distributing Movies with the Flash Player

The Flash Player application comes with Flash. It can be used to play any SWF file without the assistance of a web browser. The Flash Player (see Figure 32.1) offers several menu options with which you control the playback and appearance of a movie. You can find the application in the Players folder, inside the folder where Flash resides on your computer's hard drive. For Macintosh users, the stand-alone player is named SAFlash-Player; for Windows folks, it's named SAFlashPlayer.exe.

click to expand
Figure 32.1: A movie running on a local computer with the Flash Player application

Because the Flash Player will play any SWF file, it's very easy to distribute your movies in a compact manner, over a variety of platforms, and with minimal fuss. The average computer user won't have this application, however. Thus, it isn't the best delivery option if you're trying to target a large number of people-unless you're sure they all have the Flash Player application installed (meaning that they already own the Flash authoring application). To make your movie deliverable to the widest possible audience, use a self-contained Flash projector.

Delivering Movies as Self-Contained Flash Projectors

Self-contained Flash projectors are quite possibly the best way to distribute your movies outside the Web. A self-contained projector is an executable file-a self-contained application that will run your movie just as you created it on either Windows or a Macintosh operating system. Anyone using Windows or a Mac (which is just about everybody) will be able to see your Flash masterpiece without the help of any additional software or web-browser plug-in. Fantastic! Plus, by putting a self-contained projector on a CD-ROM, you're able to hand it out to fans, clients , customers, students, and so on, in a format that is easily accessible on any computer with a CD-ROM drive. Figure 32.2 shows a Flash projector in context.

click to expand
Figure 32.2: A self-contained projector can run in its own window or on the full screen (as shown here).

 

Creating Flash Projectors

Creating, or, more appropriately, publishing, a Flash projector is very simple. And because Flash allows you to create both Macintosh and Windows projectors, you can take care of creating both files in a single step. One minor disadvantage is that the self-contained projector will be a few hundred kilobytes larger than the SWF version of the same movie. This is because the projector file must contain information necessary for playing your movie using the resources of the operating system on which the projector is running.

To publish a self-contained Flash projector:

1.     When you've finished creating the movie, choose File Save to save it with any final changes in place.

2.     Choose File Publish Settings. The Publish Settings dialog box opens (see Figure 32.3).

click to expand
Figure 32.3:
The Publish Settings dialog box contains the options for creating self-contained projectors.

3.     Check the box next to Windows Projector or Macintosh Projector depending on what kind of projector you need to create. Check both boxes if you want to create both varieties. You can give each version a name in the adjacent File field. Be sure to leave the .exe suffix on the name of your Windows projector.

4.      New to MX 2004      As an optional step, you can take advantage of two new publishing- related features in Flash MX 2004 and MX Pro 2004:

§                               Click the Select Publish Destination button to save each published projector to a unique location. In this case, you could put one in a Mac folder and the other in a folder named Windows .

§                               Use the Current Profile menu (see Figure 33.3) to create a "projectors only" profile. To learn how to create publishing profiles, see Chapter 30.

5.     To finally publish the projector, do one of the following:

§                               Click the Publish button. This will publish your projector immediately. This option is helpful if you need to publish several different kinds of movies in one sitting.

§                               Click OK to accept the selections you've just made in the Publish Settings dialog box. Then select File Publish (Shift+F12) to publish your projector(s).

The Publishing window opens, showing the progress made toward publishing your movie. When it is finished, your projector file(s) should be sitting in the same folder as the Flash file you are currently using.

6.     Quit Flash (File Quit/Exit). After being published, Flash stand-alone projectors are given a circular icon showing the Flash MX f . Double-click the projector's circular icon to launch the self-contained projector application. The file is now ready to be burned onto a CD-ROM.

 

Using Flash to Create CD-ROM Interfaces

Although publishing your self-contained projector is the final step of the process, there are many additional things you can do with your movie to make it look and act more like a self-sufficient application. With the help of a few ActionScript commands, you can take your Flash movie and turn it into an independent multimedia production that is controlled in precisely the ways you define. Not only does this give your piece a more professional look and feel, but it allows you to set the stage for the ways in which your audience chooses to view your work.

FSCommands

FSCommands are an element of ActionScript that allow Flash and the Flash Player to communicate with the application that is hosting your movie. In the context of this chapter, that application is either the Macintosh or Windows operating system. By issuing FSCommands in your movie, you can set many different parameters for the movie's presentation, and the options available to the audience who is viewing it. The syntax for fscommand() is as follows :

 fscommand("command","argument"); 

The available commands for fscommand() are:

fullscreen      This command takes one of two arguments, true or false . When set to true , the projector fills the entire monitor window and displays no menu bar at the top of the screen. When set to false , the projector appears in a window whose size is set by the dimensions specified in the Movie Properties dialog box.

allowscale      This command, when set to true , allows the movie to stretch to fit the size of the window (or monitor) playing it. When set to false , the window that contains the movie can be stretched as needed, but the movie itself is not scaled.

showmenu      When set to true , this command enables the options in the context menu (Ctrl+click/right-click) for a projector file. These options allow your audience to play, stop, rewind, zoom, and change the display quality of the projector file. When set to false , all options are grayed out or removed, with the exception of the Settings option and the About Macromedia Flash Player option.

trapallkeys      This command, when set to true , will disable the keyboard. When set to false (the default), the movie can accept input from the keyboard. Watch out-by setting trapallkeys to true , you are effectively cutting off the keyboard. If you do this to prevent nonscripted interaction with your movie, be sure to include a button or other element with the fscommand("quit") statement for shutting down the projector.

exec      Use the exec command to launch another application from the Flash projector. The new application will appear over the projector file. The argument for this command is specified as a string containing the relative path to the application you want to launch. For example:

 on(release){ 
   fscommand("exec", "TimeMe"); 
 } 

For the exec command to work, the application that you wish to launch must be in a separate folder named fscommand . In the previous example, if the SWF were in a folder named /files , the path to the application TimeMe is required to be /files/fscommand/ . Note however, that the path is not included in the second parameter of the function.

quit      This command takes no arguments. When it's issued, your computer will close the projector file.

All FSCommands ( quit , exec , and so on) and their arguments are entered as strings. For example:

 fscommand ("fullscreen", "true"); 

This statement sets a projector to play in full-screen mode. The command fullscreen and its argument true are listed in quotation marks, making each a text string. If you don't enter the arguments as strings, Flash won't be able to communicate properly with the operating system and perform the actions you specify.

The best place for FSCommands is in a frame on the main Timeline. Put them in the first frame of the movie so that they are executed before any other scripts are called. If you place your FSCommands in your movie's first frame, they will require no handler and will be one of the first movie parameters loaded into memory.

Letterbox Projectors and CD Interface Elements

Using FSCommands is the first step toward creating a truly unique CD-ROM for your Flash movie. This section introduces you to a few design-related techniques that you can employ to create a stylish and functional movie for cross-platform distribution.

The first technique involves creating a letterbox-style projector. Letterbox is a term used to describe the appearance of a full-screen video image. When you go to a movie theater, you see films on a screen that is quite different from the monitor on your television or computer. Rather than the standard 4:3 aspect ratio, movie screens have a 16:9 aspect ratio. These screens are much wider than they are tall and accommodate a broader field of view. Consequently, when studio films are re-released on video and DVD for consumers' televisions and VCRs, they are often modified to fit the 4:3 aspect ratio.

In some cases, though, this isn't done. To preserve the 16:9 cinematic aspect ratio, videos and DVDs can be released in letterbox (or widescreen ) format. Roughly the top one-third and the bottom one-third of the screen are left black, and the image fills the entire width of the display. Ultimately, this format makes the image smaller than if it were in the 4:3 ratio but preserves the original proportions of the film. Although letterbox is used as a technical convention, it has a very stylish look and can lend an interesting visual quality to Flash projector files.

Creating the letterbox effect is very simple and involves only a few small modifications to your movie:

1.     Select Modify Document. The Document Properties dialog box opens. Set your movie dimensions so that they conform to the 16:9 aspect ratio (such as 320 — 180 or 640 — 360).

 

Note  

Changing the movie dimensions of a finished animation often creates problems with the alignment and position of movie elements. So it's best to adjust the dimensions before you create the Flash movie.

2.     Set the background color of the movie to black, even if you want your movie to have a different background color. When you create a self-contained projector, the background color of the movie is used to determine the color of the monitor when you play the movie in full-screen mode. Click OK to close the Document Properties dialog box.

3.     Create a new layer in your movie and name it letterbox . Drag this layer so that it's at the bottom of all other layers in the Timeline. Select Insert New Symbol and create a new graphic symbol that is a rectangle exactly the same size as your Stage. Make the rectangle whatever color you want for your movie background. Drag the rectangle onto the letterbox layer, positioning it in the center of the Stage. Lock the layer once it's in position.

4.     Create another new layer and name it code . Insert a new keyframe in frame 1 of this layer, highlight it, and press F9 to display the Actions panel. Enter the following statements:

5. fscommand ("allowscale", "false");

fscommand ("fullscreen", "true");

The first statement in this script prohibits the movie from being scaled, and preserves the dimensions set in the movie's properties. To scale the movie so that it fills the width of the screen, you can set "allowscale" to true , but the letterbox effect is more pronounced when it is false .

The second statement in the script, sets your projector so that it plays back full-screen-meaning that it fills the entire monitor, covering the computer's desktop and any applications that are running. The "fullscreen" statement is crucial to the success of the letterbox technique, because it uses the background color of your movie (black) to create the matte that surrounds the 16:9 area of your Stage.

6.     Publish your movie as a self-contained projector and see the letterbox effect in context.

By setting the movie dimensions to a 16:9 ratio, you established the initial effect. The black background color created the black mask. Then, by using a symbol as a colored backdrop for the movie, you created the impression that the Stage's color is something other than black. The size of the backdrop matches your Stage size, and the letterbox effect is complete. See Figure 32.4 for an illustration.

click to expand
Figure 32.4: A letterbox projec-tor playing in full-screen mode

 

Note  

This technique treats the rectangular symbol like background scenery in a theater production. In the same way that a stage crew might change props during a play, you can change the color or other attributes of the background symbol in your movie.

You can also create custom menus for your movie. Using the button techniques outlined in Chapter 15, you can create a series of buttons (menu bar) to serve as navigational controls for your projector. Then, with some basic ActionScript, you can attach commands to the buttons that will start, stop, rewind, skip, and perform all the necessary behaviors you require for navigation and other kinds of interactivity. To learn more about ActionScript commands that allow your audience to interactively navigate through your movie, see Chapter 19 or the ActionScript Reference on this book's companion CD.

Something interesting that you can do with a menu bar is allow your audience to toggle it off and on-it's there when they want it, and gone when they don't. This is especially useful for full-screen projectors, where you don't want a permanent menu or other navigational element cluttering your screen and distracting from your movie. There are many ways to toggle something off and on; consider the following example:

 _root.menu._visible=false; 
 keyWatcher = new Object(); 
 keyWatcher.onKeyDown=function(){ 
   if(Key.getCode()==Key.SPACE){ 
   _root.menu._visible=true; 
   } 
 } 
 keyWatcher.onKeyUp=function(){ 
   if(Key.getCode()==Key.SPACE){ 
   _root.menu._visible=false; 
   } 
 } 
 Key.addListener(keyWatcher); 

This script creates a simple toggle behavior for a Movie Clip instance called menu . Any time a key is pressed, events are broadcast to the Listener object keyWatcher . When the events are either keyDown or keyUp , the script tests to see whether the key creating the event happens to be the spacebar. If it is, then menu is shown while the spacebar is down, and hidden when it is up. Of course, while menu is visible, all the navigation buttons it contains are available. This allows your audience to toggle the menu "on" with the spacebar, and then click the buttons within the Movie Clip that make your movie do whatever it is that the users need to do: rewind, skip to another section, quit, and so on. To work properly, menu must be invisible when the movie is first played . This is handled by the first line of the script.

 On the CD      To see both the letterbox projector technique and a spacebar menu toggle in a self-con-tained projector, see the file projectorDemo (Macintosh) or projectorDemo.exe (Windows) in the Chapter 32 folder on this book's companion CD. To examine the source file and to witness these scripts in context, see projectorDemo.fla in the same folder.

 

Inspirational Design Model

One of the best ways to find the inspiration needed to produce your own CD-ROM is to see just how easy it is to create the disc. A task that might have once seemed daunting and mysterious is actually very doable, provided that you have the necessary resources. The following list provides a good variety of information and advice for all your CD-ROM burning needs.

www. roxio .com      Roxio is the manufacturer of Toast 6 Titanium, the premiere tool for cross-platform (hybrid) CD burning in a Macintosh environment. To learn more about using Toast 6 Titanium, see Bonus Hands On, "CD Burning for Cross-platform Flash Movies" on this book's companion CD.

www.apple.com/creative/resources/ superdrive      If you have an Apple G4 or G5, your computer is probably equipped with a SuperDrive. A SuperDrive is an all-in-one CD/DVD authoring device available in many Apple computers. This resource on the Apple website offers many technical specifics about the SuperDrive as well as links to helpful articles about CD and DVD authoring in a Macintosh environment.

www.nero.com      Nero 6 is the Windows-compatible CD-burning tool for creating hybrid CDs in a Windows environment. This PC-only burning application is manufactured by Ahead Software. To read more about Nero 6, see the section "Beyond Burning Basics" in Bonus Hands On, "CD Burning for Cross-platform Flash Movies" on this book's companion CD.

www.microsoft.com/windowsxp/expertzone/focuson/cdburning.asp      This article on the Microsoft website fields a variety of issues concerning CD burning in a Windows XP environment. See this resource to learn more about CD burning basics, troubleshooting tips, and a list of Windows XP-compatible devices.

 



Flash MX 2004 Savvy. Also Covers Flash Professional.
Flash Mx2004; Also Covers Flash Professional; Savvy
ISBN: 0471789151
EAN: 2147483647
Year: 2003
Pages: 54

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net