Pages

Tuesday, February 20, 2007

making swf active in I E- no need to click it

When we embed the swf in a html page and view it in browser.
Its not active by default and on rollOver we get a message like this
: Press SPACEBAR or ENTER to Activate and use this control.

To Avoid this problem follow the following steps

1) Replace the object tag in html (in which we are embeding swf) by div
<div class="div03" style="opacity: .75; height: 385px;" id="flashContentLayer"> <script language='javascript'>fnPutFlashObject()</script>

2) write a function fnPutFlashObject() in an external js file

function fnPutFlashObject()
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="1000" height="392" id = "main">');
document.write('<param name="movie" value="swf/flash-banner_left_ver1.swf">');
document.write('<PARAM NAME=wmode VALUE=transparent>');
document.write('<PARAM NAME=menu VALUE=false>');
document.write('<param name="quality" value="high">');
document.write('<embed src="swf/flash-banner_left_ver1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="392" id="main"></embed>');
document.write('</object>');

}

3) and include this js file in script tag
<script type="text/JavaScript" src="jsFiles/Source.js">

and it works !