Welcome to WebmasterWorld Guest from 54.226.246.160

Forum Moderators: not2easy

Message Too Old, No Replies

Javascript to replace .swf with .gif

Javascript to replace .swf with .gif

     

lambrettaluke

10:39 am on Jul 27, 2007 (gmt 0)

5+ Year Member



Hi,I'm after a script that will point a user without flash plugin to an animated .gif

Any ideas?

Cheers, Luke

edit reason: cleaned up post.

[edited by: limbo at 1:40 pm (utc) on July 27, 2007]

rocknbil

8:12 pm on Jul 27, 2007 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome aboard lambrettaluke, generally you would create an alternate image on publishing the .swf directly from Flash.

Here's an old version I used to use. Unfortunately it renders your document javascript-dependent and is bereft with some other problems (Goold "Satay Method".) It may need some nursing but will point you in the right direction.


<script type="text/javascript">
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
// PUT THE PREVIOUS TWO LINES ALL ON ONE LINE
if (plugin) {
var words = navigator.plugins["Shockwave 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.indexOf("MSIE")>=0 &&
(navigator.appVersion.indexOf("Win")!= -1)) {
// PUT THE PREVIOUS TWO LINES ALL ON ONE LINE
vb = '<scr' + 'ipt type=\"text\/jav' + 'ascr' + 'ipt\"\> \n'+
'on error resume next \n'+
'MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n'+
'</scr' + 'ipt\> \n';
document.write(vb);
}
if (MM_FlashCanPlay) {
headerContent = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+
' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '+
' id="header" width="700" height="131" align="center">'+
' <param name="movie" value="header.swf"> <param name="quality" value="high"> <param name="bgcolor" value="#FFFFFF"> '+
' <embed src="header.swf" quality="high" bgcolor="#FFFFFF" '+
' swLiveConnect="false" width="700" height="131" name="header" align="center"'+
' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'+
' </embed>\n </object>\n';
}
else{
headerContent = '<img src="header.gif" width="700" height="131" border="0" ALT="">';
}
</script>

<script type="text/javascript"> document.write(headerContent); </script>

limbo

2:54 pm on Jul 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another option might be to WRAP the object tags - and set the background image of your container to your animated gif...
 

Featured Threads

Hot Threads This Week

Hot Threads This Month