Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Embedding Flash Using the <object> Tag 401

14


First, the version of the tag that works with older versions of Internet Explorer:


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780"
height="420">




The height and width attributes are necessary to define how much space the
will take up. The classid attribute identifies the ActiveX control that will be used to
display the content in the browser. That long, random-looking collection of letters and
numbers is the address of the ActiveX control in the Windows Registry. Your best bet is
to find an example of Flash embedding and copy it from there.


When you’re specifying the height and width for a Flash movie, be
sure to take the size of the player into account, too. Some play-
ers include a border, and nearly all of them provide controls for
the video playback. You need to account for these parts of the
window to make sure your video is shown at the resolution you
anticipated.

TIP

The element is used with to provide additional information about the
content being embedded to the plug-in referenced by the tag. The ele-
ment has two attributes: name and value. This element provides the Flash player
with the URL of the movie to be played.


The preceding markup will work in Internet Explorer 8, embedding the Flash mov ie
named movie .swf. Here’s the markup for the tag for other browsers:


<object type="application/x-shockwave-flash" data="myContent.swf" width="780"
height="420">



For non-Internet Explorer browsers, you specify the plug-in to use with the type attri-
bute, and the URL of the movie to play with the data attribute. As you can see, the
height and width attributes are included here, too. The type attribute is used to provide
an Internet media type (or content type). The browser knows which content types map to
which plug-ins, so it can figure out whether you have the proper plug-in installed. If you
do, it can load it and render the content at the URL specified by the data attribute. In the
sidebar, I explain exactly what Internet media types are.