Adding a SWF to the template using swfObject

If you'd like to use the swfobject.js file and method, you can read the full documentation here: documentation. But essentially, we're going to use the dynamic publishing option to include our SWF file.

1. Using the SWF file included in this book's code packet, create a new directory in your theme called flash and place the SWF file in it. Then, create a div with alternative content and a script tag that includes the following JavaScript:

<script type="text/javascript">

swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0"); </script>

<div id="myContent">

<p>Alternative content</p> </div>

2. Add this ID rule to your stylesheet (I placed it just below my other header and intHeader ID rules):

#flashHold{ float: right; margin-top: 12px; margin-right: 47px;

As long as you take care to make sure the div is positioned correctly, the object embed code has the correct height and width of your Flash file, and you're not accidentally overwriting any parts of the theme that contain WordPress template tags or other valuable PHP code, you're good to go.

What's the Satay method?

It's a cleaner way to embed your Flash movies while still supporting web standards. Drew McLellan discusses its development in detail in his article: This method was fine on its own until IE6 decided to include its ActiveX security restriction. Nowadays, a modified embed method called the "nested-objects method": flashembedcagematch/ is used with the swfObject JavaScript we just covered.

Good developer's tip:

Even if you loathe IE (as lots of us as developers tend to), it is an "industry standard" browser and you have to work with it. I've found the Microsoft's IE blog ( extremely useful in keeping tabs on IE so that I can better develop CSS-based templates for it. While you're at it, go ahead and subscribe to the RSS feeds for Firefox (, Safari (http://, and your other favorite browsers. You'll be surprised at the insight you can glean, which can be extremely handy if you ever need to debug CSS or JavaScripts for one of those browsers.

Was this article helpful?

0 0
Make Money Blogging

Make Money Blogging

It is fine to get started on a hosted solution like Blogger.comor They will allow you to learn the basics of blogging and web publishing without spending money. As soon as you nail down these basics, however, it is vital to buy your own domain name and to purchase a web hosting package with some company.

Get My Free Ebook

Post a comment