[ Team LiB ] Previous Section Next Section

Recipe 17.3 Automatically Creating HTML Template for Including Flash Files


You want to automatically generate the required HTML for embedding a Flash file in a web component.


From within Macromedia Flash 6, use the "File Publish" menu command to output an HTML file that includes the object and embed tags.


With an .swf file open in Macromedia Flash 6, use the "File Publish" menu command to create an HTML file. This file includes the necessary tags to embed the Flash movie you are working on in a web component. Then cut and paste these tags and attributes into your JSP. Example 17-5 shows the output from using this menu command with an .swf file named example.swf.

Example 17-5. Automatically generated template text from within the Flash application
<meta http-equiv=Content-Type content="text/html;  charset=ISO-8859-1">
<BODY bgcolor="#FFFFFF">

<!-- URL's used in the movie-->
<!-- text used in the movie-->
<!--DeductionsPaycheckSDIAnnual SalaryMedicareSocial 

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  cab#version=6,0,0,0"WIDTH="550" HEIGHT="400" id="example" ALIGN=""

 <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="550" HEIGHT=
   "400" NAME="example" ALIGN=""
   TYPE="application/x-shockwave-flash" PLUGINSPAGE=


Your JSP probably already includes the boilerplate HTML such as the body tag; therefore, you only have to cut and paste the noncommented, emphasized code in Example 17-5.

The example.swf file resides in the same directory as the HTML file in this example.

Example 17-6 in the next recipe shows a JSP file with the same type of Flash-related object and embed tags as those illustrated in this recipe. Figure 17-3 shows the automatically generated HTML file from Example 17-5.

Figure 17-3. HTML template text with an embedded Flash file

The displayed Flash movie is derived from one of the Flash samples that accompanies the Flash 6 application: Paycheck_calculator.swf.

See Also

Macromedia technical notes page: http://www.macromedia.com/support/flash/technotes.html; an article about alternative techniques to using the embed tag: http://www.macromedia.com/devnet/mx/dreamweaver/articles/flash_satay.html.

    [ Team LiB ] Previous Section Next Section