FlashVars made easy - writeFlash

Download

Download writeFlash 1.02 code and sample

Update - writeFlash 1.02 - adds support for name parameter - needed for use with FSCommand - 19th May 2005

Update - writeFlash 1.01 - adds flashvars directly to the querystring to support Flash 5 - 22nd March 2005

History

You might remember the kerfuffle caused by the Eolas patent in late 2003. Around that time, Peter Elst released a neat javascript method, insertFlash, that got around the problem by dynamically writing the code needed to place Flash objects on screen. Even though the patent issues have receeded into the distance, I've found that using javascript to write Flash objects is a very convenient and trouble-free way of doing things. I extended that javascript to include an easy way to write flashvars - an area that often causes confusion especially when UTF8/Unicode values are used.

I tidied up that code over the weekend and changed the function name to 'writeFlash' to avoid confusion with the original function call which has slightly different arguments.

License

With Peter's permission, I'm releasing it under a BSD license which means that it can be used in all types of projects.

Usage

To use writeFlash, you'll just need to include the javascript file and a call to the write function in your HTML document. It will look something like this,

writeFlash("writeFlashDemo.swf","300","200",{menu:"false",bgcolor:"#FFFFFF",version:"6,0,47,0",align:"left"},{passTextIn:"myparam"});

All the options and default values are documented in the javascript file. Please report any bugs as you find them - I'll try to keep writeFlash updated with any workarounds or idosyncracies needed for different browsers or Flash versions - and so all that information will become codified in a single function.

Alternative

Geoff Stearns has another javascript solution which may be of interest, especially if you're focussed on web standards and XHTML.

Posted by Alexander at March 14, 2005 09:38 AM

Make Flash tests and assessments with the Question Writer, Quiz Software. Question Writer 4 is now available. Click here to download.

Trackback Pings

TrackBack URL for this entry:
http://www.centralquestion.com/elearning/mt-realtb.cgi/18