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: http://code.google.com/p/swfobject/wiki/ 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: http://www.alistapart.com/articles/flashsatay. 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": http://www.alistapart.com/articles/ 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 (http://blogs.msdn.com/ie/) 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 (http://developer.mozilla.org/devnews/), Safari (http:// developer.apple.com/internet/safari/), 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.

Cash For Blogging

Cash For Blogging

There are sites that will pay you upfront, pay you a percentage of the revenue that your content makes, and sites that will hire you to write or blog for them. You can start earning money per article or blog post in as little as a few days with some of these sites.

Get My Free Ebook


Post a comment