You are not Logged in
Would you like to Login or Register

Today is: Friday, 21 November, 2008
Check this months hot topics

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.

kick it on DotNetKicks.com del.icio.us digg Mister Wong YahooMyWeb Reddit Furl Spurl blogmarks
Andrew Clark Skype
Author : Andrew Clark
Published : Tuesday, 10 July, 2007

Web Application Developer

Add Comment

Enter your comment below and it will be submitted for moderation.

Your Name

Add Tag

Please enter tags for this article, seperated by semi-colon ;

View Tag's by : # articles | # views

More Publications

Not using Google Analytics? You should be!
Paul Marshall - 23/8/2006
TAB inside input boxes
Barrington Haynes - 13/6/2006
Web service calls from javascript using ATLAS (part 1)
Dave Howard - 25/8/2006
Image reflection the easy way!
Andrew Clark - 5/4/2007
Web service calls from javascript using ATLAS (part 3) - Complex properties
Dave Howard - 25/8/2006