Appendix H. Embedding a Flash Movie in a Web Page

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Part III:  Appendixes

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   CLASS   CODEBASE= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"   WIDTH="550"   HEIGHT="400"      ALIGN="">   <PARAM NAME="movie" VALUE="main.swf">   <PARAM NAME="quality" VALUE="high">   <PARAM NAME="bgcolor" VALUE="#FFFFFF">         <EMBED       src="/books/4/13/1/html/2/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

CLASS

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"



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net