Flash ActiveX Workaround Javascript Fix

Here is how to fix the activex issue “click to activate” by using javascript.

Here is how to fix the activex issue “click to activate” by using javascript with the flash embed tag and object tags.

The answer is to take your embed and object tags and place each line in a javascript function called document.write().

For example if you wanted to write something to be displayed in html from javascript, you would do this

document.write(“<b>My name is Alex</b>”);

Notice you can use html tags inside the two Quotes.

Ok here is an over view on how you would setup the html and javascript file.

1) First in flash publish setting, make sure to include the html and then click publish.

2) Next open the html page and take each flash embed and object tags and place them in a separate javascript file named “flash.js” between the document.wite function like so:

function embedFlash()
{
document.wite(‘<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0″ width=”990″ height=”200″ id=”your_flash_file” align=”middle”>’);
document.write(‘<param name=”allowScriptAccess” value=”sameDomain” />’);
document.write(‘<param name=”movie” value=”your_flash_file.swf” /><param name=”quality” value=”high” /><param name=”bgcolor” value=”#ffffff” />’);
document.write(‘<embed src=”your_flash_file.swf” quality=”high” bgcolor=”#ffffff” width=”990″ height=”200″ name=”your_flash_file” align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer” />’);
document.write(‘</object>’);
}

NOTE: We place all of the document.write() functions in to our own custom function call embedFlash(){ }.

3) Next in the html file you will need to include the javascript file to call that new custom function we created call “embedFlash” like so:

<html>
<body>
<script src=”flash.js” type=”text/javascript”></script>
<script type=”text/javascript”> embedFlash();</script>
</body>
</html>

That’s it. The html above is just a striped down version of an html page without the header and title tags. But you get the picture!

Tagged :

Leave a Reply

Your email address will not be published. Required fields are marked *