GeekZilla
Activating flash automatically with javascript
I find it really annoying when you go to a website and you have a flash movie or flash navigation and you have to click on the flash to activate it before you can start interacting with it. With a little bit of javascript you can automatically activate the movie so it becomes a seemless part of a website.
Here is how it works:
Include the javascript file you can find here:
http://blog.deconcept.com/swfobject/
Then put this on your page where the flash is.
<div id="flashcontent"> This text is replaced by the Flash movie. </div> <script type="text/javascript"> var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699"); so.write("flashcontent"); </script>
Thats it! If javascript is disabled then the content of the div is shown so you can put a useful message there.
There is a full breakdown of each part of the solution with further examples at the link above.
Author Andrew Clark
Web Application Developer