Table of Contents

Appendix H. Embedding a Flash Movie in a Web Page

To embed a Flash movie in a web page we use the HTML <EMBED> and <OBJECT> tags, much like we use the <IMG> tag to place a GIF or a JPEG on a page. Recent versions of Internet Explorer (IE) for Windows (IE5.5 SP2 and later) require the <OBJECT> tag (the <OBJECT> tag is also preferred over the <EMBED> tag even for earlier versions of IE for Windows, which supported both tags). Internet Explorer for Macintosh and Netscape on both platforms require the <EMBED> tag, as do many minor browsers. Therefore, to support all browsers, we nest the <EMBED> tag within the <OBJECT> tag as shown in Example H-1, which embeds a movie called main.swf in an HTML page.

Example H-1. <OBJECT> AND <EMBED> tags for embedding a .swf file in an HTML page
<OBJECT
  CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  CODEBASE=
"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
  WIDTH="550"
  HEIGHT="400"
  ID="main"
  ALIGN="">
  <PARAM NAME="movie" VALUE="main.swf">
  <PARAM NAME="quality" VALUE="high">
  <PARAM NAME="bgcolor" VALUE="#FFFFFF">
   
    <EMBED
      SRC="main.swf"
      QUALITY="high"
      BGCOLOR="#FFFFFF"
      WIDTH="550"
      HEIGHT="400"
      NAME="main"
      ALIGN=""
      TYPE="application/x-shockwave-flash"
      PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
    </EMBED>
</OBJECT>

In the Flash authoring tool, you can use the File figs/U2192.gif Publish command to generate <EMBED> and <OBJECT> tags automatically. For instructions, see Help figs/U2192.gif Using Flash figs/U2192.gif Publishing figs/U2192.gif Publishing Flash documents.

For more information on the <EMBED> and <OBJECT> tags, see Help figs/U2192.gif Using Flash figs/U2192.gif Publishing figs/U2192.gif Editing Flash HTML settings. See also the following technotes:

http://www.macromedia.com/support/flash/ts/documents/tn4150.html
http://www.macromedia.com/support/flash/ts/documents/tag_attributes.htm

Despite the assistance offered by the Flash authoring tool, this appendix is for developers who prefer to hand-code their HTML. This appendix also covers the attributes not supported via the authoring tool.

Table H-1 lists the minimum recommended attributes of the <EMBED> and <OBJECT> tags, some of which are strictly required. Following the table are detailed descriptions of these and other attributes.

Table H-1. Recommended attributes of the <OBJECT> and <EMBED> tags

Description

<OBJECT> attribute

<EMBED> attribute

Identifies content as Flash

CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

TYPE="application/x-shockwave-flash"

Location of the Flash Player browser plugin

CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"

PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"

URL of .swf file

<PARAM NAME="MOVIE" VALUE="url">

SRC="url"

Height of the movie

HEIGHT="height"

HEIGHT="height"

Width of the movie

WIDTH="width"

WIDTH="width"


Table of Contents