HTML and CSS Reference
In-Depth Information
<p> Alternative content </p>
The first line loads the external JavaScript file into the page. You'll need to make sure
that the src attribute points to the correct location for your copy of swfobject.js . You'll
learn more about JavaScript and external JavaScript files in Lesson 14. The next three
lines are some JavaScript code that's embedded within the page. Here's the line between
the opening and closing <script> tag:
swfobject.registerObject( object ID , required Flash version , movie URL );
The italicized text represents placeholders for the values that you need to plug in to reg-
ister SWFObject. As you can see, SWFObject requires the ID of the <object> tag, the
version of Flash that your movie requires, and the URL of the movie to be played.
The other option is to use the JavaScript-based approach. Here's the code:
<script type=”text/javascript” src=”swfobject.js”></script>
<script type=”text/javascript”>
swfobject.embedSWF(“myContent.swf”, “myContent”, “300”, “120”, “9.0.0”);
<div id=”myContent”>
<p> Alternative content </p>
As you can see, the main difference is that the <object> tags are gone entirely. Instead,
I've got a <div> tag that serves as the container for the Flash movie. The alternative con-
tent that will be displayed if the Flash player is not present or does not satisfy the version
requirement is placed within the <div> . The JavaScript call to dynamically publish Flash
movies is a bit different from the one used in the static publishing method:
swfobject.embedSWF( movie URL , ID of the target div , width , height , required
Flash version );
Many Flash movies enable configuration through a parameter named FlashVars . You
can specify them using the <param> tag:
<param name=”FlashVars” value=”controls=on” />
The configuration variables that are available depend entirely on the Flash movie that
you're using. You can also configure the movie through the dynamic publishing
approach, but it requires a bit more knowledge of JavaScript. For more information,
check out the online documentation for SWFObject after the JavaScript lessons.
In the next section, I talk about some specific Flash video players, both of which can be
embedded in a page using SWFObject.
Search WWH ::

Custom Search