I've moved the flash detection script that is generated by Flash MX into a function and then called this function onLoad. I've tested the code with several alert boxes. In Internet Explorer the line "var plugin = (navigator.mimeTypes && navigator.mimeTypes["appli
cation/x-s
hockwave-f
lash"]) ? navigator.mimeTypes["appli
cation/x-s
hockwave-f
lash"].ena
bledPlugin
: 0;" returns 0, this used to work when not in a function. This works fine in Mozilla 1.4
The code:
<script language="Javascript1.1">
<!--
function write_flash(srcFlash, srcStatic, fshHeight, fshWidth, mapName, loop)
{
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["appli
cation/x-s
hockwave-f
lash"]) ? navigator.mimeTypes["appli
cation/x-s
hockwave-f
lash"].ena
bledPlugin
: 0;
if (plugin) {
var words = navigator.plugins["Shockwa
ve Flash"].description.split(
" ");
for (var i = 0; i < words.length; ++i) {
if (isNaN(parseInt(words[i]))
)
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
} else if ((navigator.userAgent && navigator.userAgent.indexO
f("MSIE") >= 0) && (navigator.appVersion.inde
xOf("Win")
!= -1)) {
document.write('<scr' + 'ipt language="VBScript"\>');
document.write('on error resume next\n');
document.write('MM_FlashCa
nPlay = (IsObject(CreateObject("Sh
ockwaveFla
sh.Shockwa
veFlash." & MM_contentVersion)))');
document.write('</scr' + 'ipt\>');
}
if (loop == true) {
loopParam = '<param name="loop" value="true">';
loopCode = '';
} else {
loopParam = '<param name="loop" value="false">';
loopCode = 'loop="false"';
}
if (MM_FlashCanPlay) {
document.write('<object classid="clsid:D27CDB6E-AE
6D-11cf-96
B8-4445535
40000"');
document.write(' codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"')
;
document.write(' id="'+mapName+'" width="'+fshWidth+'" height="'+fshHeight+'">');
document.write('<param name="movie" value="'+srcFlash+'"><para
m name="menu" value="false"><param name="quality" value="best">');
document.write('<param name="scale" value="noscale"><param name="bgcolor" value="#000000">'+loopPara
m);
document.write('<embed src="'+srcFlash+'" menu="false" quality="best"'+loopCode+'
scale="noscale" bgcolor=#000000 ');
document.write(' swLiveConnect="false" width="'+fshWidth+'" height="'+fshHeight+'" name="'+mapName+'"');
document.write(' type="application/x-shockw
ave-flash"
pluginspage="
http://www.macromedia.com/go/getflashplayer">');
document.write('</embed>')
;
document.write('</object>'
);
} else {
document.write('<img src="'+srcStatic+'" width="'+fshWidth+'" height="'+fshHeight+'" usemap="#'+mapName+'" border="0">');
}
}
//-->
</script>
further down the page I call the function with:
<map name="eyes"></map><script language="JavaScript1.1">d
ocument.on
Load = write_flash("_flash/eyes.s
wf", "_images/kmx_eyes.jpg", "91", "203", "eyes", true)</script><noscript><i
mg src="_images/kmx_eyes.jpg"
width="203" height="91" usemap="#eyes" border="0"></noscript>
This is weird as all I did was move it inside a function, first without any modification, and it stopped working. I modified it later thinking I could work the problem out but for some reason the "var plugin =..." is not working now in IE.
Any help appreciated. Sorry about the points on this question I've only just registered, will have to earn a few ;)