homepage Welcome to WebmasterWorld Guest from 54.243.13.30
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
Forum Library, Charter, Moderator: open

Site Graphics and Multimedia Design Forum

    
Javascript to replace .swf with .gif
Javascript to replace .swf with .gif
lambrettaluke




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

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




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

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




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved