Even though it is possible to publish your finished file (SWF), most people will not be able to view it except through a browser. And not all browsers support the capability to view SWF files without them being embedded in an HTML page. For this reason, you will usually have to publish the HTML along with the SWF, and the HTML tab (shown in Figure 7.8) will help you fine-tune it.
Figure 7.8. The HTML tab in the publish settings.
The option in the HTML tab is the Template option. This sets the basic format of your HTML. The default choice for this option is Flash Only, which will produce HTML similar to the following:
[View full width] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Example</title> </head> <body bgcolor="#ffffff"> <!url's used in the movie> <!text used in the movie> <object class codebase="http://fpdownload .macromedia.com/pub/shockwave/cabs/ flash/swflash.cab#version=8,0,0,0" width="600" height="500" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="Example.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed src="Example.swf" quality="high" bgcolor="#ffffff" width="600" height="500" name="Example" align="middle" allowScriptAccess="sameDomain" type="application /x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> </body> </html>
Note that the SWF name is in bold type so that you can easily see where it would go. This is the basic template for embedding Flash content in an HTML page. The other available templates are the following:
Flash for Pocket PC 2003 Displays Flash content in HTML with Pocket PC-specific alignment.
Flash HTTPS Displays Flash content just like Flash Only; however, if users do not have the Flash player, they are directed to an HTTPS (HTTP secure) server to get the player.
Flash with AICC Tracking Displays Flash content like normal, but also includes support for AICC tracking.
Flash with Named Anchors Displays Flash content like normal, but includes code and HTML anchors to enable bookmarking for Flash 6 content and later.
Image Map This sets up image maps to be used with either PNGs, JPEGs, or GIFs. (You must have either GIF or PNG selected to publish for this option to fully work.)
QuickTime This option will embed a QuickTime movie in the HTML document. (You must have QuickTime selected to publish for this option to fully work.)
Most of the time, the Flash Only template combined with altering the other options will suffice for your project. Here are the rest of those options for the HTML tab.
Detect Flash Version
As mentioned earlier, knowing your intended audience for your project is the best practice for choosing the correct Flash player, but even within your intended audience, not everyone will have the player, especially if you choose a newer version. This is why detecting what the latest version of the player the user is running is so important, and Flash has an easy way to do this.
In the HTML tab, there is a check box that enables you to set up the required version and subversions of the Flash player for your content. And when you publish the file, included in the HTML will be some client-side code verifying the current Flash player on the end user's computer.
You can also use the $version variable in your ActionScript to verify the player version. This variable is available to you at runtime, as the following example shows:
trace($version); //output: MAC 8,0,0,450
The preceding code shows that the current Flash player is the 8 player.
But, even if you are using an older version of the Flash player, it is still a good idea to include some type of Flash detection to make sure the user never sees the infamous "white page."
The rest of the options in the HTML tab have to do with how the Flash content will appear in the HTML itself:
Dimensions This option enables you to set the dimensions that your Flash movie will display in. These are the options:
Match Movie This choice sets the dimensions of the movie (SWF) to the same dimensions as the stage.
Pixels This choice allows you to hard-code the dimensions of your movie in pixels. Notice that when this choice is selected, the Width and Height fields become active.
Percent This choice allows you to set your Flash movie dynamically based on the window size of the browser that opens it. You can hard-code the percentage of both the width and height of your movie, and it will adjust itself as the browser adjusts. Be careful, however, if you are using bitmaps in your Flash movie, because they may not scale well. Notice that when this choice is selected, the Width and Height fields become active.
Paused at Start This is an option that has stuck around since early on in Flash. It gives you the capability to automatically pause the playback head in the first frame of your movie and wait until it's told to play again. This can easily be accomplished with a single line of code in ActionScript; the default is unselected.
Display Menu This option, when selected, displays a full featured list of options when an end user right-clicks your Flash content. This gives them the ability to control how they move through your movie as well as other key features. Most developers will turn this option off, keeping the control within the movie itself. When this option is deselected, the context menu will only display a link to their Flash Player settings (Flash Player 6 and later) and a link to information about the Flash Player. You can also disable and edit the menu from ActionScript. By default, this option is selected.
Loop This option is another option left over from previous versions of Flash. If selected, when the user gets to the final frame of your movie, the user is taken back to frame 1. If this option is not selected, the playback head will stop at the last frame. By default, this option is selected.
Device Font When selected, this option tells Flash to display system fonts when text fields in your movie are using a font that is not installed on an end user's system. By default, this option is not selected.
Quality This option is used to decide what is more importantvisual quality or performance. If Quality is set to Best, the visual quality will be high. If you choose Low, the visual quality will be lower, but performance will improve. This is a decision that should be based on your intended audience.
Window Mode This option controls the window mode of the Flash Player in your HTML. In certain versions of browsers, you can use Opaque Windowless to hide objects behind the Flash player, or use Transparent Windowless to show items behind the Flash player. The default value is Window and unless a change is necessary, it is suggested that this option stay at its default.
HTML Alignment This option aligns your Flash movie in the HTML document itself. This option is essential when you are attempting to have your Flash movie as close to the edge of the browser as possible.
Scale This option determines how your Flash movie will scale if the dimensions of the browser are not exactly the same as your Flash movie. And almost all the time, they will not be exactly the same. This option has the following choices:
Default (Show all) The default value will display the entire movie without having to change its proportions.
No Border This choice scales the movie to the specified area, but it may also crop your movie to keep its proportions.
Exact Fit This choice displays the entire movie to the exact size and may distort your movie depending on which Dimensions choice you made.
No Scale This option will prevent your Flash movie from scaling at all when the browser resizes.
Flash Alignment This option will attempt to align and/or crop your Flash movie based on the other options selected.
Show Warning Messages This option, when selected, displays information about your options if they conflict with each other, or if there are errors in your code that conflict with your player settings. By default, this option is selected, which is recommended.
That concludes the options for the basic Publish Settings setup. Now let's look at some of the other publishing format options.