HTML and CSS Reference
In-Depth Information
The bottom line on <embed> is that you shouldn't use it. I've included it here because
you'll probably see it on other sites, but there are better ways to embed media into a web
Embedding Flash Movies Using
SWFObject is a combination of markup and JavaScript that provides a way to embed
Flash movies in web pages using standards-compliant markup that still supports all the
browsers that are currently in use. JavaScript is a programming language that runs within
the context of a web page. I explain how it works in more detail in Lesson 14,
“Introducing JavaScript.” You don't need to know how to program in JavaScript to use
SWFObject; you just need to copy and paste some code and fill in a few blanks. To
download SWFObject and read the documentation, go to
Aside from providing a reliable way to present Flash movies using standards-compliant
markup, SWFObject also works around a problem that can't be dealt with using markup
alone. When the version of the Flash player a user has installed is too old to play a
movie, the movie will not be presented and any alternative content you provided will not
be displayed. The browser hands off the movie to the Flash player assuming it will work
and doesn't handle things gracefully if it does not. SWFObject uses JavaScript to catch
these errors and show the correct alternative content when they occur.
SWFObject provides two approaches to embedding content, one uses markup augmented
by a bit of JavaScript, the other uses pure JavaScript. Using markup provides better per-
formance and offers some level of functionality if JavaScript is disabled or the content is
republished in an environment where the JavaScript is not included. The dynamic version
is a bit more flexible in that it enables you to configure the embedded player on-the-fly.
Using SWFObject with markup (referred to as static publishing) requires three steps:
adding the <object> tags, including the swfobject.js file in the page, and registering
the player with the SWFObject library. Here's the code:
<script type=”text/javascript” src=”swfobject.js”></script>
<script type=”text/javascript”>
swfobject.registerObject(“myId”, “9.0.115”, “expressInstall.swf”);
<object id=”myId” classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000”
width=”780” height=”420”>
<param name=”movie” value=”myContent.swf” />
<object type=”application/x-shockwave-flash” data=”myContent.swf” width=”780”
Search WWH ::

Custom Search