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
 <HTML> <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--> <!--DeductionsPaycheckSDIAnnual SalaryMedicareSocial  securityESPP401k$#%FederalStateMarriedSingleactions-->  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"   codebase=   "   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=    "">   </EMBED> </OBJECT>  </BODY> </HTML> 

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:; an article about alternative techniques to using the embed tag:

Java Servlet & JSP Cookbook
Java Servlet & JSP Cookbook
ISBN: 0596005725
EAN: 2147483647
Year: 2004
Pages: 326

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