Use javascript to embed a flash object
I’m sure everyone’s been browsing the net using Internet Explorer and noticed that annoying “Click to activate the ActiveX Control” thing. This was implemented by Microsoft due to a security flaw but what if you happen to know that what you are embedding is secure?
In this case, use Javascript to embed your flash object. The javascript has to be in a seperate .js file.
Example:
<!-- include .js file -->
<script type="text/javascript" src="/js/writeFlash.js"></script>
.
.
.
<!-- call function -->
<script language="JavaScript" type="text/javascript">
RunFlash(#flashwidth#, #flashheight#, "#flashmovie#");
</script>
And here’s the JavaScript code:
function RunFlash(flashWidth, flashHeight, flashMovie) {
var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+ 'width='+flashWidth+' height='+flashHeight+' '
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
+ '<param name="movie" value="/files/'+flashMovie+'" /><param name="quality" value="high" /><param name="bgcolor" value="##ffffff" /><param name="wmode" value="transparent">'
+ '<embed src="/files/'+flashMovie+'" quality="high" bgcolor="##ffffff" '
+ 'width="'+flashWidth+'" height="'+flashHeight+'" align="left" wmode="transparent"'
+ 'play="true"'
+ 'loop="false"'
+ 'quality="high"'
+ 'allowScriptAccess="sameDomain"'
+ 'type="application/x-shockwave-flash"'
+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
+ '<\\/embed>'
+ '<\\/object>';
document.write(oeTags); // embed the flash movie
}