In Macromedia Flash 8 Basic (and Professional), designers and developers are able to include metadata into a SWF file so that search engines can find them, index them, and rank them higher in the results of a search. You've already seen where metadata is added when you modified document properties such as Stage size and ruler units.
To put a Flash document on the web, you have to start by publishing a SWF file. You have already published SWF files when you embedded video in Lesson 7 and every time you tested your application with Control > Test Movie. This is why you can view your entire Tech Bookstore web application. However, for your Tech Bookstore application to be visible on the web, you have to embed at least the main SWF file, which in this case is the TechBookstore.swf (and loader.swf) into an HTML document. Fortunately, Flash can produce the HTML document for you and the HTML tags that embed the SWF file into it in the Publish Settings dialog box.
In this lesson, you will publish the Tech Bookstore and loader.swf with particular settings and loader SWF file and then embed the documents into a web page.
Open the techBookstore.fla file that you created in Lesson 10. Choose Modify > Document to add metadata.
You can also enter the Document Properties dialog box by pressing the size button on the Property inspector.
In the Document Properties dialog box, enter a descriptive title in the Title field; in the Description field, enter a brief description of what the Tech Bookstore website is, does, and offers. Refer to the previous figure if you're stumped on what to write. Press OK when you are finished.
To increase the likelihood of ranking higher in search results, repeat significant keywords often in your description without being silly. Avoid common words and conjunctions. For the Tech Bookstore, repeating "books" or "software" throughout the description would make sense.
In a normal setting, you would add metadata to all your Flash files prior to publishing. Here, we are just focusing on the main application itself.
Open the Publish Settings dialog box by choosing File > Publish settings.
Additionally you can open techBookstore.fla from lesson11/start on this book's CD-ROM. There are tabs in the Publish Settings dialog box that allow you to control the files that are generated by Flash.
You used the Formats tab in several lessons to deselect the HTML option so the document is not published along with the SWF file (because you don't need it). This tab allows you to add additional file formats to publish as well, including an EXE or an HQX, which is usually known as a Flash projector file. These files are useful for creating CD-ROMs and kiosk presentations. Flash Player is embedded right into the executable file, so there is no need to worry about whether your end user has the latest Flash Player. Other file formats include image file formats and even the MOV video format.
Click the Create New Profile button at the top of the Publish Settings dialog box. Enter a name for the Publish profile and click OK.
A Publish profile saves a file on your hard drive that contains information about the publish settings you specify prior to creating the profile. This is handy if you always use the same settings to publish for many documents (such as all the SWF files you are loading into the Tech Bookstore file). You don't necessarily need a Publish profile for this document, but at least you know how to make one now. You will use this profile in the next exercise, but you will modify it to fit the necessary publish settings for loader.fla.
After you click the Create New Profile button, the Create New Profile dialog box opens. Enter Tech Bookstore or something similar into the text field as the new name for the Publish profile and click OK when you are finished.
The new name is added to the Current profile drop-down list when you return to the Publish Settings dialog box. Now you can modify the settings of the Publish profile as required. These settings are saved into the profile.
Make sure that the HTML format is still deselected, and that the SWF file format is selected.
You are loading the TechBookstore.swf file into the loader.swf file so there is a progress bar for the site; therefore, you don't need an HTML page for the bookstore and you can deselect this check box. You will need the HTML page for the loader SWF file, which you will amend in the next exercise.
Click the Flash Tab and make sure the document is set to Flash Player 8, Bottom up Load order, and ActionScript 2.0 as the ActionScript version. Then make sure the Compress movie check box is selected. Select the Protect From Import and Omit Trace Actions check boxes.
All these settings are shown in the following figure. The Flash tab enables you to modify what version of Flash Player you are publishing the file to. You can change the version of ActionScript you are using (this includes the default components, which use ActionScript 2.0). Leave the document at the default ActionScript 2.0 setting for the document.
The player version must be determined based on the content of the Flash document. If you have ActionScript that does not work with the version of the player you have selected, errors are shown either in the Output panel or an error message appears when you try to save the file. When you use certain components that require Flash Player 8, you need to set the player version to Flash Player 8 (and ActionScript 2.0) in order for them to work. Other components can be set to Flash Player 6 or 7 and use ActionScript 2.0.
If you are unsure about which Flash Player or ActionScript version you need, you can try testing the SWF file by pressing Ctrl+Enter and viewing the results in the player. If you don't see the element in your SWF file, you know you have to modify the settings.
ActionScript not supported by your selected player version will have a yellow highlight in the Actions panel. Load order specifies the order that the layers in your FLA files load into the Flash Player at runtime. If you choose Bottom up (default setting), the layers load from the lowest to highest. This is evident when someone with a slow Internet connection views your site because the items on the Stage appear in the layer order that you specify. It also can affect your ActionScript as well because the actions on lower layers (if you have them there) will be loaded before those on higher layers, if you use this particular setting. The Load order affects only the first frame of your SWF file.
There are many additional options available to you in this tab. Generate Size Report means the Output panel shows the amount of data in the final SWF file, broken down into content: frames, symbols, text characters, actions, and bitmaps. If you Omit Trace Actions, you won't see anything traced to the Output panel when you test the SWF file; however, when you publish for the final version of your SWF file and you have used ActionScript with trace actions, this setting is a must. When this is selected, Flash removes the trace actions from your ActionScriptboth to reduce final file size and for a performance increase a little bit. An end user doesn't have an Output window in the browser, but that won't stop Flash Player from trying to execute trace actions!
When you protect a FLA file from import (using the Protect From Import option), the setting prevents other people from importing your SWF file into their own FLA documents, unless they have the password, which you type into the password field. SWF files import as a series of frames, bitmaps, and graphic symbols. Importing an SWF file does not preserve any ActionScript, layers, or components. If you lose a FLA file, importing the SWF file doesn't "get your FLA file back." It does help you get the images, but you'll have to reconstruct other aspects of the FLA file over again. But then again, this is why you back your files up, right?
You should be aware that even if you do protect your SWF file from import, there are tools available online that can undo this option. There are also tools to open your SWF files and see the ActionScript that you use. Never, ever place sensitive information (such as passwords or similar) in a SWF file. If you select Debugging Permitted, you can remotely debug the SWF file. You can access the file when it is online and enter a password when prompted, which also helps protect the SWF file. If someone downloads the SWF file, they must use the password when they import it into Flash.
And finally, the Compress Movie option allows you to compress the SWF file so it's a smaller size. This works only for the Flash Player 6 r65 and greater (r65 refers to a minor release of Flash Player 6), so your visitors must have at least this version of player installed on their systems to view the SWF file. This is fine because you are creating a SWF file for Flash Player 8.
Set the JPEG quality setting to 100 and select the Override Sound Settings check box. Leave the default Audio Stream and Audio Event settings at their default settings.
The JPEG quality compresses the bitmap images in your FLA file as JPEGs with whatever quality you have specified with this slider. A higher value on the slider means a better-quality image because the JPEG is not compressed as much. If you set the quality too low, the SWF file size is smaller, but the images might end up distorted. If you will deploy over the web, optimize your images in a tool such as Macromedia Fireworks or Adobe ImageReady, and set this slider to 100! You have greater control over your image quality versus your image file size in these other tools, and it is a horrible idea to compress images that have already been compressed. Because your images have already been optimized for the web, you are setting your quality to 100 to prevent any further compression from happening.
Select the Override Sound Settings check box. Whatever properties for each sound that you individually set using the library and Properties dialog box in the authoring environment are overridden by these settings for the entire SWF file, which helps decrease the overall file size of the SWF file when it's published. You can change the compression, the sample rate, and whether the sound is an event or streamed sound if you click the Set buttons. The default settings (MP3 with a bit rate of 16Kbps and Mono) is adequate for the Tech Bookstore. Of course, if you compressed sound in the Sound Properties from the Library panel, you were probably doing that for a very good reason. In that circumstance, you would not choose to override those settings.
To publish a file in one step, all you need to do is choose File > Publish from the main menu. This process automatically publishes the FLA file using whatever the current or default Publish Settings are. The files are created in whichever directory the current FLA file resides. For the Local Playback Security option, leave the default selected, which is Access Local Files Only. When you are playing an SWF file locally, your SWF file can interact with different resources on your local computer or from a network that you may be connected to. For instance, you can store a JPEG or PNG image in a directory on your computer or on your network, which can be loaded dynamically when the SWF runs. It won't, however, be able to retrieve information from a different domain or an Internet resource, like Amazon.com or Petco.com. If you select Access Network Only, resources such as your LoadVars text files can be accessed only from a network, not locally.
Click the Publish button to publish the file. Then click the Import/Export Profile button and choose Export from the menu that appears to export the Publish profile you just created.
After you click Publish, techBookstore.swf is generated into the TechBookstore folder. Now you need to export the Publish profile to use it in other FLA files. The profile is saved as an XML document on your hard drive. The XML file contains your settings, which can then be imported into the Publish Settings dialog box when you create another FLA file where you need the profile.
Choose Export from the drop-down list that opens when you click the Import/Export Profile button. The Export Profile dialog box opens, in which you can type in a filename to save the profile as (or leave it as) Tech Bookstore. Click Save to export the Publish profile. Now you can import the profile into other FLA files that you create.
Click OK to close the Publish Settings dialog box. Save the changes you made to the Tech Bookstore by selecting File > Save.
After you have published the bookstore SWF file and exported the Publish profile, you are finished with the bookstore.