1
   

How do ya load images for those without Flash?

 
 
Monger
 
Reply Tue 5 Aug, 2003 09:24 pm
I'm very new to Flash. Just installed Flash MX a couple days ago. So far so good.

I bought a generic flash header thingie for one of my sites, and now I've fiddled with Flash enough so I managed to customize it just the way I wanted it.

I'm using the following code to display the header on my HTML pages..
Code:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=780 HEIGHT=185>
<PARAM NAME=movie VALUE="0151.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#ffffff>
<EMBED src="0151.swf" quality=high bgcolor=#ffffff WIDTH=780 HEIGHT=185 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>


..That code has no problems..it makes a window pop up if the Flash plugin hasn't been installed yet, asking if you want to install it.

But I know a lot of people who hate Flash with a passion, so I'd like to do it a little diferently. Ideally, if the flash plugin is not installed it should simply load a jpg image for the header instead. I don't want a flash & non-flash version of all the pages either. Anybody know the best way to pull this off?


Edit: removed url
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 3,318 • Replies: 22
No top replies

 
Craven de Kere
 
  1  
Reply Tue 5 Aug, 2003 09:51 pm
Well, this is actually pretty easy once you are off in the right direction. You need client-side scripting so you should use javascript.

Here is a simple way:


IN HEAD:

Code:<SCRIPT Language = "JavaScript">

function FlashInstalled()
{
result = false;

if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
{
result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
}
else if (document.all && (navigator.appVersion.indexOf("Mac")==-1))
{
eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj) result = true; xObj = null; } catch (e) {}');
}
return result;
}

function FlashWrite(url,width,height)
{
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
document.write(' WIDTH=' + width + ' HEIGHT=' + height + '>');
document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
document.write(' <EMBED src="' + url + '" quality=high bgcolor=#FFFFFF ');
document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
document.write(' </EMBED></OBJECT>');
}
</SCRIPT>


call it:

Code:<SCRIPT Language = "JavaScript">
if (FlashInstalled())
FlashWrite('flashfile.swf',468,60);
else
document.write('<img src="img.gif" width=600 height=400 border="0">');
</SCRIPT>


There are many other ways, including page redirects etc. But you get the general idea. Use clientside scripting to detect the plugin and then it's a simple if / else.
0 Replies
 
Craven de Kere
 
  1  
Reply Tue 5 Aug, 2003 09:57 pm
um, I don't feel like uninstalling flash to test it so if you do test it lemme know how it goes.
0 Replies
 
Monger
 
  1  
Reply Tue 5 Aug, 2003 10:00 pm
Fantastic. Thanks for the quick reply, Craven! I'll implement the changes as soon as I get a couple other things worked out for it.
0 Replies
 
Monger
 
  1  
Reply Tue 5 Aug, 2003 10:05 pm
Craven de Kere wrote:
um, I don't feel like uninstalling flash to test it so if you do test it lemme know how it goes.


Will do. But since I don't wanna uninstall Flash either it'll be a few days before I can upload it and check it out on another PC without Flash, as right now I'm removing the menus from the swf & putting them into DHTML so I gotta get that going before I upload again.

Cheers mate!
0 Replies
 
Craven de Kere
 
  1  
Reply Tue 5 Aug, 2003 10:08 pm
I like the header BTW, can you PM me the place you bought it from?
0 Replies
 
Monger
 
  1  
Reply Sun 10 Aug, 2003 11:41 am
Bit overdue here, but it works great!
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 10 Aug, 2003 03:21 pm
Good news. ;-)
0 Replies
 
BobbyDouglas
 
  1  
Reply Fri 29 Aug, 2003 01:46 pm
How would I use this for a site who needs to use two different .swf, and two different .jpg?

Just changes the variables?
0 Replies
 
Craven de Kere
 
  1  
Reply Fri 29 Aug, 2003 01:52 pm
You could just use it twice while renaming the function. That's the easiest way. But rewriting the script would be better (I don't have time to do this since I won't uninstall flash).
0 Replies
 
Monger
 
  1  
Reply Fri 29 Aug, 2003 09:15 pm
You shouldn't need to rewrite the script that goes in HEAD, just change the variables in the part used to call it. eg:

Code:<SCRIPT Language = "JavaScript">
if (FlashInstalled())
FlashWrite('flashfile1.swf',200,100);
else
document.write('<img src="img1.gif" width=200 height=100 border=0>');
</SCRIPT>
...Some page content in between...
Code:<SCRIPT Language = "JavaScript">
if (FlashInstalled())
FlashWrite('flashfile2.swf',200,100);
else
document.write('<img src="img2.gif" width=200 height=100 border=0>');
</SCRIPT>
0 Replies
 
Craven de Kere
 
  1  
Reply Fri 29 Aug, 2003 09:18 pm
Quite right. I forgot that the width and height variables are passed to the head code from the invocation code.
0 Replies
 
Monger
 
  1  
Reply Fri 29 Aug, 2003 09:24 pm
Smile It's a vera useful script. Thanks fer posting it Crave.
0 Replies
 
Craven de Kere
 
  1  
Reply Fri 29 Aug, 2003 09:26 pm
I use the same principle in a script for multiple user launched popups from the same headscript.

I collect these and tinker with them all the time.

When A2K 3.0 comes out it will have a huge collection of scripts with the goal of having the largest collection online within a year.
0 Replies
 
Monger
 
  1  
Reply Fri 29 Aug, 2003 09:31 pm
Whoop-de-freaking-doo!! If this was somehow tied in with forum stuff, where people could post comments on, ask for help with, or post modifications to the script that'd be wicked!--and unique as far as I know for a behemoth-script-gallery type of page.
0 Replies
 
Craven de Kere
 
  1  
Reply Fri 29 Aug, 2003 09:33 pm
Forum integration is the key. It's goan be a big project but I've been planning it for over a year now and am quite ready.
0 Replies
 
Monger
 
  1  
Reply Mon 1 Sep, 2003 09:23 am
Methinks something it would really need is a way to somehow rate each script and comment (since some comments would contain code). 'Twould be very helpful when navigating huge lists of scripts.
0 Replies
 
Craven de Kere
 
  1  
Reply Mon 1 Sep, 2003 03:34 pm
Yup, it will ahve both of those features.
0 Replies
 
Monger
 
  1  
Reply Tue 7 Oct, 2003 08:32 pm
Okay, the code above works great on English systems, but with Japanese IE6 it doesn't work. I suppose it's possible that browsers in some languages other than Japanese have the same problem. It still asks if you'd like to install Flash (and if you say no it doesn't load the alternate picture of course).

So there's something in the FlashInstalled() function that's returning an inaccurate 'true' with Japanese IE. Any ideas?

Here's the FlashInstalled() function from the script above...
Code:function FlashInstalled()
{
result = false;

if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
{
result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
}
else if (document.all && (navigator.appVersion.indexOf("Mac")==-1))
{
eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj) result = true; xObj = null; } catch (e) {}');
}
return result;
}


Perhaps I'm entirely wrong & it's something other than the different browser aspect that's causing the false positive. Any other ideas what could cause this problem?
0 Replies
 
Monger
 
  1  
Reply Wed 8 Oct, 2003 02:23 am
hmm, after looking at that code again I'm guessing the problem is that the flash plugin (application/x-shockwave-flash) has a different name in Japanese. If I'm right it'd mean that for this script to work for EVERYONE you'd prolly have to add code to check for the plugin in a bunch of languages. Mad

Anywho, I'll try to find out if there is in fact an alternate name for the plugin in japanese.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » How do ya load images for those without Flash?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/26/2024 at 12:20:51