If you recall the Eloas lawsuit filed against Microsoft for infringing on its patented browser technology you’ll remember Microsoft was forced to change how IE handled embedded programs within webpages. So, over the past 2 years Microsoft has been fiddling with the way handles embedded media within web pages. Early last year MS released the SP2 update, which saw the biggest changes to IE. A part from a much needed Popup Blocker,MS introduced very obtrusive ActiveX Prompt which detected embedded content and prevented pages from fully loading until the user confirmed the prompt. More recently Microsoft introduced a ‘click to active’ mechanism to IE. You may not have experienced this first hand if your a Firefox user or your lucky enough to frequent sites with workarounds in place. But essentially in order to activate embedded content such as Flash, IE requires that you actually click the movie. This is most annoying for interactivity within Flash movies when you consider it would take 2 clicks to invoke a getURL() action; on(release){ getURL('http://www.mysite.com.au', '_blank'); }. Fortunately Microsoft still lets us use JavaScript to Embed our Flash movies, and cool guys such as Geoof Stearns have already done the hard work for us - The SWFObject JavaScript. Developed by Geoff Stearns the SWFObject script is actually used by Microsoft and Adobe and it’s ridiculously easy to use. Just a simple inclusion and a small amount of JavaScript and your done:
<div id="flashPlayer"><!-- Flash content will go here //--></div>
<script type="text/javascript">
var so = new SWFObject("swf/movie.swf", "mymovie", "200", "100%", "7", "#336699");
so.addParam("quality", "low");
so.addParam("wmode", "transparent");
so.addParam("salign", "t");
so.addVariable("mp3File", "mp3/numb.mp3");
so.write("flashPlayer");
</script>
Here’s a quick rundown of the script;
Create the HTML element which will contain the final Flash content(I’ve used a div):
<div id="flashPlayer"><!-- Flash content will go here //--></div>
Create a new SWFObject, pass it the path to the swf file, movie name, width, height and Player version we want to detect for followed by the background colour:
var so = new SWFObject("movie.swf", "mymovie", "200", "100%", "7", "#336699");
Add the usual parameters using the addParam(param name, value); function:
so.addParam("qality","low");
Pass as many variables as you want to Flash with the addVariable(variable name, value); function:
so.addVariable("mp3File", "mp3/numb.mp3");
Finally write the Flash content to the HTMLcontainer you created above (the div):
so.write("flashPlayer");
More Information;
SWFObject documentation (deconcept.com)
ActiveX changes in Internet Explorer (MSDN)
There are also extensions available to integrate IE workarounds, I haven’t tested these myself though
Dreamweaver MX 2004/8 Extensions;
Softery IE Flash Problem Solver by Softery (on Adobe Exchange) (FREE)
CMX Insert FlashObject 1.2 by Paul Newman (on Community MX)
GoLive 5.x Extensions;
JM SWFObject Action by Jesper Moller (on Adobe Exchange) (FREE)