View Full Version : Problem calling a SWF file from external JS file

09-26-2008, 09:13 AM
Hi all, i have a script where it checks for the browser whether it plays SWF. If it supports SWF then the SWF will be loaded or else an image is loaded. I used to have those JS code in index.php where there was no problem working in IE. Now i have moved the code to an external file and called it as a function in index.php. The SWF plays very well in firefox but not in any versions of IE. I tried to alerts, alert inside elseif and flash cannot play condition is executed. Only the instructions inside false condition gets executed i.e., "flash cannot play so load the image". Can someone help me out in this. Its knida urgent.:-(

Thanks in advance,

09-26-2008, 01:23 PM
can you post some code so some of us may be able to to test it ourselves???

09-26-2008, 04:07 PM
below is the code,

function flashintro()
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
if (isNaN(parseInt(words[i])))
var MM_PluginVersion = words[i];
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
alert("inside elseif");
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
if ( MM_FlashCanPlay ) {
alert("inside flash can play");
document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="226px" height="380px" id="cms">');
document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
document.writeln('<param name="movie" value="http://local-server/projects/webstix_cms/templates/Home_Page/images/webstix_flash.swf" />');
document.writeln('<param name="quality" value="high" />');
document.writeln('<param name="bgcolor" value="#ffffff" />');
document.writeln('<param name="wmode" value="transparent" />');
document.writeln('<embed src="http://local-server/projects/webstix_cms/templates/Home_Page/images/webstix_flash.swf" quality="high" bgcolor="#ffffff" width="226px" height="380px" name="cms" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /></object>');
} else{
alert("inside flash cannot play");
document.write('<IMG SRC="templates/Home_Page/images/index_logo&nav.jpg" BORDER="0" ALT="" usemap="#Map">');

document.write('<map name="Map" id="Map"><area shape="rect" coords="44,143,221,179" href="index.php?option=com_content&id=78&task=view&Itemid=96" alt="Website Design" />');
document.write('<area shape="rect" coords="46,196,220,235" href="index.php?option=com_content&task=view&id=61&Itemid=62" alt="Content Management System" />');
document.write('<area shape="rect" coords="45,252,220,288" href="index.php?option=com_content&task=view&id=62&Itemid=77" alt="Search Engine Optimization" />');
document.write('<area shape="rect" coords="45,310,220,345" href="index.php?option=com_content&id=84&task=view&Itemid=102" alt="Website Maintenance" />');

please some one help.