?
Solved

show gif or jpg if flash not installed

Posted on 2006-05-06
8
Medium Priority
?
392 Views
Last Modified: 2012-06-21
hi

brand new to flash 8....

i want to publish a small flash graphic to my web and i want to publish in at least flash 7.0 compatibility...

i have placed the HTML in the web page and all works fine...

but, is there a way to automatically display a static jpg or gif as a substitute if the user does not have the correct version (or any version) of flash installed in their browser?
0
Comment
Question by:naifyboy123
  • 3
  • 3
  • 2
8 Comments
 
LVL 5

Expert Comment

by:wings_gaurav
ID: 16622858
hi,

the below javascript code should do it - it's from http://www.kirupa.com/developer/mx/detection.htm

<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 7;
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])))
            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)) {
      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 )
{
      //do document.write to add code for flash
}
else
{
       //do document.write to add code for image
}
//-->

</SCRIPT>

-wings
0
 
LVL 5

Assisted Solution

by:wings_gaurav
wings_gaurav earned 600 total points
ID: 16622864
better still - from the same URL http://www.kirupa.com/developer/mx/detection.htm
you will need to only change the image source and the falsh movie name.


<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 7;
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])))
            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)) {
      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 ) {
            document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
      document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
      document.write(' ID="script" WIDTH="300" HEIGHT="200" ALIGN="">');
      document.write(' <PARAM NAME=movie VALUE="script.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  ');
      document.write(' <EMBED src="script.swf" quality=high bgcolor=#FFFFFF  ');
      document.write(' swLiveConnect=FALSE WIDTH="300" HEIGHT="200" NAME="script" ALIGN=""');
      document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
      document.write(' </EMBED>');
      document.write(' </OBJECT>');
} else{
      document.write('<IMG SRC="script.gif" WIDTH="300" HEIGHT="200" usemap="#script" BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT><IMG SRC="script.gif" WIDTH="300" HEIGHT="200" usemap="#script" BORDER=0></NOSCRIPT>

-wings
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16623569
Hi,
you may also try this one..

Best Flash deduction kit available on internet
http://blog.deconcept.com/swfobject/


this flash deduction is better than "Macromedia Flash Player Detection Kit"
because it works on javascript,
plus ease of use, just include a javascript file, add flash swf details and alternative code(if flash is not available.)

Rgds
Aneesh

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:naifyboy123
ID: 16624732
thanks guys...

wings - i assume i can sue this as an external javascript?

and

annshchopra - i have read, downloaded and had a look at your option, however, i can not see how to use a .jpg or .gif as an alternative if flash is not installed on the user's browser.

0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 1400 total points
ID: 16624754
if you use the standard Flash embed method of Flash object, as shown here:
http://blog.deconcept.com/swfobject/swfobject.html

now view html source of above url, and find the  following:
----------------------------------
<strong>You need to upgrade your Flash Player</strong>
This is replaced by the Flash content.
Place your alternate content here and users without the Flash plugin or with
Javascript turned off will see this. Content here allows you to leave out <code>noscript</code>
tags. Include a link to <a href="swfobject.html?detectflash=false">bypass the detection</a> if you wish.
---------------------------------------

replace the above code with your <img> tag,
that's all

if flash player will not be installed it will display the your image


Rgds
Aneesh
0
 
LVL 5

Expert Comment

by:wings_gaurav
ID: 16625232
yes, you can use it as an external javascript too - i don't see any complication in saving it as a js and including it in the HTML page.

-wings
0
 

Author Comment

by:naifyboy123
ID: 16629130
thanks guys - i have to go away for a few days but will test when i return. then i will sort the points out.

cheers
0
 

Author Comment

by:naifyboy123
ID: 16633873
both work really well - i opted for aneeshchopra's option as there are instructions and switches i can use on it.

thank you both
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question