View Single Post
Old 05-22-2006, 12:52 AM   #1 (permalink)
Sean
 
Sean's Avatar
 
Title: Founder/Admin
Join Date: Jan 2004
Location: Sydney, Australia
Age: 28
Posts: 8,907
Blog Entries: 4
Rep Power: 10 Sean will become famous soon enough
Send a message via MSN to Sean Send a message via Skype™ to Sean
Arrow Embedding flash with swfobject.js

Recently Microsoft has released a patch for Internet Explorer which effected how flash looked in IE.
The new patch added borders around flash and made users double click on flash objects which was not only ugly but annoying.

Here is how i now add flash to my sites which removes the above problems and is also XTHML compliant.

HTML Code:
<script type="text/javascript" src="swfobject.zip"></script>
<div id="flash">
  This text will be replaced by your SWF
</div>
<script type="text/javascript">
   var so = new SWFObject("header.swf", "flash", "950", "176", "7", "#ffffff");
   so.write("flash");
</script> 
Quick explanation:
HTML Code:
<div id="flash">
  This text will be replaced by your SWF
</div> 
This creates a HTML element which will hold the SWF movie.

"movie.swf" -Path to your SWF
"flash" -ID of your embed tag
"950" -width of your SWF
"176" -height of your SWF
"7" -The required player version for your Flash content
"#ffffff" - Background color of your flash movie

Make sure to download the attachment swfobject.js otherwise this script will not work.
Attached Files
File Type: zip swfobject.zip (2.2 KB, 30 views)
Sean is offline   Reply With Quote