Site Loading ...

Filed in Main Tuesday May 9, 2006

Ok.

Lots of people are aware of… and annoyed by the ActiveX issues surrounding embedded flash (and other things) in IE. I personally have only been effected by the flash issues though so for now Im ignoring the rest.

My friend Dan pointed me towards SWFObject… a javascript by Geoff StearnsĀ (visit him at blog.deconcept.com) which can be used to embed flash without any issues.

The invocation code is a little much for sites that are flash heavy… or people who just like to write as little code as possible. Dan had written a nifty little php script to insert all the javascript more easily… even his simplified code was too much for me though so I made my own.

Read on for examples, explanations and all kinds of stuff that will make your life easier if you care about this whole ActiveX problem…

Heres the link to a little page I set up to illustrate the problem as well as the fix: Click Here

Why not just use JS invocation?

Heres the code for an example flash file that would have to be entered without my function:

<div id=“flag368″><script type=“text/javascript”>
var so = new SWFObject(“flag.swf”, “flag368″, “300″, “213″, “8″, “#000000″);
so.addParam(“allowScriptAccess”, “sameDomain”);
so.addParam(“quality”, “high”);
so.addParam(“wmode”, “transparent”);
so.addParam(“scale”, “showall”);
so.addParam(“loop”, “false”);
so.addParam(“menu”, “false”);
so.addParam(“play”, “true”);
so.write(“flag368″);
</script></div>
<p />

Heres the code needed to embed the same flash with my function:

<!–p embedFlash ( ‘flag’ , ‘300′ , ‘213′ );–>

Much less code… eh?

anyway… all you have to do is include the javascript by Geoff in your head tags… include the php code anywhere in your page… and then you can use the short invocation code for any flash file on your page.

there are only 3 required variables… $name $width and $height… if your swf is in a differnet folder you also have to add a varible for it… $location

theres a whole bunch more variables you can add if you want… which could get a bit confusing… so I mage an invocation code generator :: Click HERE

the link above (Demo and Stuff) shows how it all works pretty well… Ill eventually make a readme file for usage and spell it all out in detail.

For now… take a look at the links provided in this post… and download the ZIP file I packaged everything in.

Downloads:

  • Download ZIP file HERE

ok… post comments if you want… let me know what you think… etc.


2 Responses to “embedFlash() - Fix ActiveX issues…”

  1. John Says:

    ignore the comments in the php file… I havent yet updated them from the first version I made… so there is some incorrect info in the comments at the top of the page.

  2. AP Says:

    I usually publish my movies at 60fps when I use this as compaired to straight SWFObject my animations are slower…. does this set some kind of speed variable or something? Anyone else had this happen?

Leave a Reply