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

(singke) #1
ptg16476052

Embedding Flash Movies Using SWFObject 407

14



Alternative content






The next three lines are some JavaScript code that’s embedded within the page:



The italicized text represents placeholders for the values that you need to plug in to regis-
ter SWFObject. As you can see, SWFObject requires the ID of the tag (myId),
the version of Flash that your movie requires (9.0.115), and the URL of the movie to be
played (mymovie.swf).


The other option is to use dynamic publishing. First put the JavaScript in the of
your document as before:



Then embed your SWF file and include alternative content:




Alternative content



As you can see, the main difference is that the tags are gone entirely. Instead,
I’ve got a
tag that serves as the container for the Flash movie. The alternate con-
tent that will be displayed if the Flash player is not present or does not satisfy the version
requirement is placed within the
. 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 tag: