Just a quick post on a snippet of code I always forget (I think it must be my age). I use SWFObject (v2.x) to include Flash into pages, but I always forget how to embed it with a transparent background; not anymore:
1 2 3 4 5 | var flashvars = {}; var params = {wmode:"transparent"}; var attributes = {}; swfobject.embedSWF("/swf/yourSWF.swf", "anim", "300", "200", "9.0.0","/swf/expressInstall.swf", flashvars, params, attributes); |
It’s just so simple, I have no idea why I never remember it. Simply pass an object with “wmode” set to “transparent” when you call embedSWF().
On a side note you can always load SWFObject from the Google AJAX Libraries API:
1 2 3 4 | <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load("swfobject", "2.2"); </script> |
It can take some pressure off your own server in serving the file and there’s a chance that the user will have the file cached from a previous site using SWFObject.
Update: Have removed the quotation marks around wmode as it was causing issues, thanks junats!
junats on March 4 10 / 62 Permalink
had some issues doing it like this (with quotations ):
var params = {“wmode”:”transparent”};
but this did the trick (without quotations ):
var params = {wmode:”transparent”};
Matt on March 4 10 / 62 Permalink
Strange how that didn’t occur on mine, maybe it depends on the browser.
Thanks for the feedback, I’ll update the code.
Anderson on August 11 10 / 222 Permalink
Nice man, thanks!