Section 14.1. Flash on CD-ROM

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):

  • The performance of Flash assets in a browser window is worse than in a non-browser environment. When a browser is also running, it must have some attention from the computer, too, so it makes sense that removing it from the mix will boost your playback slightly.

  • The browser and any other resources it may require (themes, extensions, other plug-ins, etc.) cause your product to require more RAM.

  • The browser can interfere with your product, most notably when it comes to responding to user input. To operate properly, the browser must occasionally receive mouse and keyboard input from the user (such as when the user types a web address in the browser's location bar, clicks on a button, or uses a keyboard shortcut). Your Flash files may also need to receive user input. Therefore, if your Flash file doesn't have mouse and/or keyboard focus (that is, if it isn't identified as the correct recipient for mouse and/or keyboard events), the browser can intercept user events and your product can seem unresponsive.

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 Test Movie menu command, commonly accessed by the Ctrl-Enter/Cmd-Return keyboard shortcut). If not, choose File Publish Settings and click on the Formats button in the button bar at the top of the dialog. Using this screen, you can specify that one or more file formats be created from your file when it is published. Creating projectors is as easy as enabling the checkbox next to one or both of the projector platform options, as seen in Figure 14-1.

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:

  1. Open box_guy_proj_01.fla from the 14 folder of your working directory.

  2. Open the File Projector Settings dialog, select Format, and confirm that the projector option for your platform has already been set. Also confirm that a user-friendly name is set for the projector.

  3. In the same 14 directory as the file you just opened, find the projector you just created and double-click on it to launch the application.

  4. The file will play without the need of the Flash authoring environment or a browser, and it can be distributed to others even if they have neither.

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.

Table 14-1. Commands available for projectors






Closes the projector.


true or false

Specifying true sets the Flash Player to fullscreen mode. Specifying false returns the player to normal menu view.


true or false

Specifying false sets the player so that the .swf file is always drawn at its original size and never scaled. Specifying true forces the .swf file to scale to 100% of the player window.


true or false

Specifying true enables the full set of contextmenu items. Specifying false hides all of the context-menu items except About Flash Player and Settings.


Path to application

Executes an application from within the projector. The path can contain only the characters AZ, az, 09, period (.), and underscore (_). The application to be launched must be in a subdirectory fscommand in the same directory as the projector.


true or false

Specifying true sends all key events to the onClipEvent(keyDown/keyUp) handler in the Flash Player.

Try one of the new features now:

  1. Continuing with your open file, add the following script in frame 1 of the actions layer:


    The fscommand function is used to provide instructions to playback scenarios beyond Flash. It is primarily used in projectors, as you are using it now, but it can also be used on mobile devices and to talk to an HTML-based scripting language such as JavaScript.

  2. Save your file and publish your movie, using the File Publish menu command.

  3. 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:

    1. Using the Modify Document menu command, change the Stage color to black.

    2. You'll add a quit button next, but for the time being, save your work and publish your movie again. Most of the fscommand options will not work in a test .swf, so you must publish your file to create a projector that can be tested.

    3. Launch the new projector and see the result. (If you are checking your progress, your file should now resemble the Box Guy C projector in your platform of choice.)

    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:

    1. Quit your projector and return to your .fla file.

    2. Create a new layer just below the actions layer and call it quit button.

    3. In this new layer, create a simple button yourself, or, if you prefer, use a button component or a button from another Library to which you have access.

    4. Give the button an instance name of quit_btn and place it in the upper-right corner of your file.

    5. Add the following lines to the script in frame 1 (the fscommand quit option requires no additional parameters):

       quit_btn.onRelease = function():Void {     fscommand("quit"); } 

    6. Save your work.

    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:

    1. Add a new layer directly below the quit button layer, and call it mask.

    2. Draw a rectangle the full dimensions of the Stage.

    3. Double-click the layer icon in the mask layer to open the Layer Properties dialog, and set its type to Mask.

    4. Double-click the layer icons of each layer beneath the mask layer in turn, and set each of them to Masked.

    5. Save your work, publish your movie, and launch the new projector.

    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 ( 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.

Flash 8(c) Projects for Learning Animation and Interactivity
Flash 8: Projects for Learning Animation and Interactivity (OReilly Digital Studio)
ISBN: 0596102232
EAN: 2147483647
Year: 2006
Pages: 117

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: