Flash 8: Projects for Learning Animation and Interactivity (OReilly Digital Studio)
14.1. Flash on CD-ROM
Although many developers use Macromedia Director, another powerful multimedia authoring program, for CD-ROM development, Flash also offers very basic features suitable for CD-ROM delivery. It is certainly possible to distribute a CD-ROM project using a browser-based structure to wrap around your Flash content. This requires little extra work or planning, and if your product heavily uses HTML (perhaps repurposed from a related online version), this may be the best way to go. However, if your product is primarily Flash content, the overhead of the browser and Flash Player is unnecessary. In fact, the added weight of the browser can result in a lesser product, for several reasons (for the sake of this comparison, assume your product is Flash-only):
Finally, although it would be very surprising if this were not the case, it's still not a good idea to rely on your users having the necessary browser and Flash Player installed. This is particularly true if compatibility issues require a particular browser or version of the Flash Player. Therefore, you should add installers to your CD-ROM, which means you must also follow the necessary licensing and distribution guidelines. Fortunately, Flash can also create a runtime package that contains all the necessary code to play back your product without relying on additional software. This useful playback engine is called a projector. 14.1.1. Projectors
Think of a projector as the Flash browser plug-in without the browser. Gone is the overhead, so RAM use is reduced, performance gets a slight bump, and the user experience is vastly improved for Flash-only projects. Creating a projector is not much different from creating a .swf. The same publishing process is used, and projectors can even be created for both Windows and Macintosh platforms. You may remember from discussions in earlier chapters how to officially publish your .fla files (rather than just creating .swf files via the Control Figure 14-1. The Publish Settings options used to create projectors for Windows and Macintosh platforms Usually, you don't work hard to make your .swf filenames pretty, because the names are rarely seen when the files are loaded into an HTML page or another .swf. You should follow some simple naming rules to ensure the widest possible compatibility and ease of use across as many servers as possible, but these rules are usually optional. (The most notable of these suggested rules are to name your files in all lowercase and to avoid spaces and other illegal or inconvenient URL characters.) When creating a projector, however, you are creating an application whose name the user will likely see and double-click. Suddenly, concise, useful names become a lot more important. Additionally, other applications (e.g., servers or browsers) don't have to process projector names, so you can be freer with your naming conventions. Note: Don't worry if you don't see these extensions on your own computer. It is common for operating systems to hide them to simplify what you see in your directories. For example, Figure 14-1 is a screen shot of the publish settings for box_guy_proj_01.fla. As that name isn't too friendly, it has been replaced with Box Guy 1. On the Windows platform, the dot-three extension is required, so .exe (which stands for executable) is added. Try creating your own projector now:
Note: To prevent naming conflicts with files you create in the same directory, the provided projectors are named with additional letters (A, B, C, etc.) rather than numbers (1, 2, 3, etc.). New features (or new ways of implementing features) for projectors are very limited. Table 14-1 lists the bulk of them.
Try one of the new features now:
This time your application provides a fully immersive experience, filling the screen, removing its menu bar, and covering up your desktop. With these added features, however, a few new things are noticeable:
Quit your movie using the application standard Ctrl/Cmd-Q, and address these issues one or two at a time. Note: Space constraints prevent Flash-JavaScript communication from being included in this book. However, if you're interested in exploring this technique on your own, fscommand has been replaced for this purpose by the much more reliable ExternalInterface API. You can find a sample file demonstrating its use nested within your main Flash 8 application directory in the /Samples and Tutorials/Samples/ActionScript/ExternalAPI folder. Begin by fixing the background color and scaling problems:
Okay…you've corrected the scale and background color issues, but something new has surfaced. Box Guy, formerly off-Stage left to begin with, is now clearly visible, as seen in Figure 14-2. Figure 14-2. When viewed in a window larger than the Stage, formerly off-Stage elements are visible and must be masked
When a .swf is framed in an HTML page, or scaled to fit the exact dimensions of a player window, off-Stage elements can't be seen. However, when a player window is scaled, or displayed full-screen without scaling, everything in the visible window can then be seen, even if it's outside the actual Stage area. You'll fix this problem in a moment, but first add a user-friendly quit button:
Next, you will create a mask to prevent your animation from being visible outside the Stage area. It's been several chapters since you've worked with mask layers, so the necessary steps follow:
Everything should be fine now. Your animation will be visible only inside the Stage area, your screen outside the Stage area will be filled with a nice sedate black that lets you focus on your art, and your new quit button makes it easy for the end user to quit your application. Your end result should now resemble Figure 14-3 and Box Guy E. If you have any problems, compare your file to box_guy_proj_05.fla in the 14 folder. Figure 14-3. The final file is properly masked and includes a convenient quit button
14.1.2. Projector Enhancers
Unfortunately, the options you've just read about and practiced with are about all a Flash projector can do. Without the ability to do moresuch as write to the user's hard drive, manipulate operating system settings, or spawn and control windows, just to name a few optionsFlash is pretty much worthless for serious CD-ROM development. Even the most basic features are lacking. For instance, a Flash projector can't even center itself on your screen or show a proper window title or application name in its interface. Fortunately, several third-party applications can add functionality to Flash projectors. One of the best cross-platform options is ScreenTime's mProjector (http://www.screentime.com). mProjector has almost 200 features for controlling the application, operating system, files, windows, menus, and more. It can even add FTP functionality to your projector, beyond what is possible with Flash 8's new file upload and download capabilities. If you intend to put a serious effort into developing quality disc-based Flash solutions, a product like mProjector is a must. |