|< Day Day Up >|
Flash's Publish feature makes the process of preparing a movie for the Web a snap. I know I've said that a lot of tasks you perform in Flash are simple, but publishing in Flash really is both simple and quick. Basically, you just select File, Publish. Publish will not only export a .swf, but it will also create the HTML file that's necessary.
HTML stands for Hypertext Markup Language. An HTML file is a text file that uses special code to describe how a web page is to be displayed. A user's browser program will first download the HTML, and the code included in it describes how the web page should display. The reason HTML is important is that every web page that you visit is really an HTML file that describes what is to be included in the page layout. Therefore, to upload a web page, you don't just upload a Flash .swf. You upload an HTML file (with an embedded .swf), and that is what the user visits.
It's interesting to know that when you type in a web address (www.phillipkerman.com, for example), your browser looks for a file named index.html (it also looks for other similarly named files if it can't find index.html). The index.html file is read in by the browser, which makes sense of its contents. Besides containing the actual text that appears onscreen, the index.html file contains the details about which size and style text to use (such as italic or bold). Because the HTML file doesn't actually have images in it, if the web page includes photographs, the HTML must specify the name and location of the image file (such as trees.jpg). The browser accumulates all the information specified in the HTML file and shows it to the user as an integrated layout of images and text.
In the case of a page that includes a Flash movie, it works almost the same way. The HTML file specifies where the Flash movie (that is, the .swf file) is located and how to display it onscreen. This is almost the same as how it specifies a static image, such as a .gif or a .jpg. In the case of the .jpg or .gif image, additional information can be included parameters such as the height and width of the image. Similarly, the HTML referring to a .swf can include parameters such as width, height, but also details such as whether the movie loops, whether it should be paused at the start, and more. This HTML basically says to put an image here, a Flash movie there, and so on. The actual code is relatively easy to learn, but it's not exactly intuitive. Besides, it's unforgiving if you make mistakes.
Fortunately, Flash's Publish feature will create the HTML file for you, so you don't really have to learn HTML. However, it is a good idea for you to learn some HTML, and one of the best ways to learn is to take a peek at the HTML Flash creates. Regardless, Publish is a neat feature you just select the Publish command, and Flash does all the work.
Publishing in Flash has three aspects. For now, we'll concentrate on Publish and Publish Preview, with which HTML and .swf files are exported; the only difference between the two is that with Preview, you see the results right away in your browser. An important component of publishing involves how you can modify every detail via the Publish Settings command (under the File menu). As you'll see in Hour 24, "Publishing a Creation," the Publish Settings command lets you specify details as well as decide what media types to export (because Flash can export more than just Flash and HTML files). The third aspect of publishing involves using, modifying, or creating templates and profiles, which give you extensive control over the HTML created when publishing. (Templates and profiles are also covered in Hour 24.)
In the following task you'll try out the File menu commands Publish and Publish Preview.
Try It Yourself: Publish a Movie
In this task you'll quickly (and easily) publish a movie for viewing in a browser. Here are the steps to follow:
When you used Publish Settings in the preceding task, you made sure that both an HTML and Flash (.swf) file would be exported upon publishing. Not only does the Formats tab allow you to specify more file types to export, but for each format you select, you're given another tab. For example, because you have HTML and Flash selected, you see a tab for each. If you look in those tabs, you see several parameters you can modify. We'll spend more time on this in Hour 24, but for now you can go ahead and check out these tabs if you like; most of the settings are pretty self-explanatory.
A few final notes on publishing: First of all, after you selected Publish in the previous task, you found the files Flash exported. Instead, you could have in one fell swoop exported the file and launched it in your browser automatically. To export the appropriate files and view them in a browser in one step, you select File, Publish Preview, Default (or press F12). You'll likely use this method in more ways than this, so it's good to understand exactly what's happening.
Second, you'll notice that the name of both the .html and .swf files match your source .fla file's name. If later you want to change the .html file's name to, say, index.html, you'll have no problem doing so. However, if you want to change the .swf file's name, you'll have to be careful. The HTML file points to the .swf file. If you open the HTML file in a text editor (such as Notepad), you'll find two references to the .swf file's name. (To open the file in Notepad, either drag the file onto the Notepad icon or open Notepad and select File, Open, making sure you change Files of Type to All Files, as shown in Figure 19.2, and point to the .html file.)
Figure 19.2. If you want to view .html files through Notepad (to see what Flash created), you just need to specify All Files in the dialog box after you select File, Open.
The two references to the .swf file's name correspond to the HTML code created for Netscape Navigator and Internet Explorer. Although the following code is just part of the HTML file created, you'll find the two parts in it:
src="/books/1/479/1/html/2/testmovie.swf" PARAM NAME=movie VALUE="testmovie.swf"
I won't explain the HTML entirely, but both lines of code need to point to the correct file. If your Flash file's name is indeed testmovie.swf, this code works. If you change your file's name, you must change these lines in your HTML code to match the new name.
Another thing to keep in mind: You don't have to export both the .html and the .swf file every time. You can select File, Export Movie to just create a new .swf based on the latest edits in your source .fla. Maybe you've already created the HTML, or maybe you've made some edits to it that you don't want overwritten by publishing again. All you need to do is select File, Export, Export Movie and then select Flash Movie from the Save As Type drop-down list in the Export Movie dialog box. When you export this way, you see one more dialog box, which lets you specify details of the Flash movie. This dialog box is identical to the Flash tab in Publish Settings dialog box (for now, just accept the defaults). Probably the easiest way is simply use Test Movie, which immediately exports only the .swf part of your Publish settings. Test Movie uses the most recent .swf options under Publish Settings.
This might sound like a lot of options, but the main decision is whether you want to export just the .swf (as in Export Movie) or both the .swf and the .html (when you use Publish).
|< Day Day Up >|