Updated April 20th
I'm so used to having a
$ method for accessing elements. Nevertheless, the idea is of course that
FlashReplace should be stand-alone, so I replaced it with the standard
Updated April 20th
Although I didn't encounter any problems with not using an
embed element (to have valid HTML code output), it has been strongly recommend that I use it to ensure maximum compatibility. Therefore, it has been added and the file size is now 2.1 kb.
Updated June 3rd
I've gotten a few e-mails asking how to add variables to the Flash movie, so here are some options:
The simplest way is to just do it through a querystring. I.e. "movieFileName.swf?testVar=hello".
Another option is to reference the movie and do it something like this:
- I didn't find the code that easy to read, and tweak, if wanted.
- The file size. SWFObject is about 6.7 kb and UFO is about 10.7 kb. I'm a sucker for small file sizes, so therefore
FlashReplaceis only 1.8 kb 2.1 kb. :-)
- Neither of them created standards-compliant code;
FlashReplacedoes. Not anymore. Now it creates an additional
embedelement for maximum compatibility
- Several lines are needed to insert a Flash Movie.
FlashReplaceonly needs one line.
My version: FlashReplaceFlashReplace is a little object with a few parameters to include a Flash movie into a web page. It should also work fine with streamed movies and get us around the Eolas patent problem in IE. It basically just supports one parameter and one method:
- A property to set the default Flash version to look for, if it isn't set with the Flash movie creation.
- A method that replaces the content of a specified element within the web page with a Flash move. Basically, the element with the fallback content if Flash player isn't available.
The parameters for the
To be more specific, the
replacemethod consists of a few parameters:
idof the HTML element where you want to replace the content with the Flash movie.
- The path to the Flash movie (i.e. the
- The id to give to the Flash movie element.
- The width of the Flash movie.
- The height of the Flash movie
- The version of the Flash player needed to see the movie. Defaults to the
defaultFlashVersionproperty of the
FlashReplaceobject if not specified.
- A way to add as many parameters as you want to the Flash movie.
Code examplesFirst, include the