There is a tag in the Allaire Tag gallery called cf_flash that does the
detection work for you.

-----Original Message-----
From: Kevin Bridges [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 10:02 AM
To: Fusebox
Subject: RE: Flash/coldfusion question




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD><TITLE><CFOUTPUT>#Main.Title#</CFOUTPUT></TITLE>

<!-- prevent caching in netscape. very important cause netscape tends to
mangle cached code -->
<META HTTP-EQUIV="expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<body bgcolor="#333333">

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
window.name="parent";
var requiredVersion = 5;                        // version the user needs to
view site (max is 5, min is 2)
var useRedirect = true;                         // "true" loads new flash or
non-flash page into browser
                                                                        //
"false" embeds movie or alternate html code into current page

// set next three vars if useRedirect is true...
var flashPage = "flash.cfm"             // the location of the flash movie
page
var noFlashPage = "noflash.cfm" // send user here if they don't have the
plugin or we can't detect it
var upgradePage = "upgradeflash.cfm"    // send user here if we detect an
old plugin and ask them to upgrade
// #############################################

var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var maxVersion = 5;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;

// -->
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1" type="text/javascript">
<!--

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

jsVersion = 1.1;

if(isIE &&
in){ 
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
        document.write('on error resume next \n');
        document.write('flash2Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
        document.write('flash3Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
        document.write('flash4Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
        document.write('flash5Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');       
        document.write('</SCR' + 'IPT\> \n');
}
// -->
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--

function detectFlash(){ 

        if (navigator.plugins){
                if (navigator.plugins["Shockwave Flash 2.0"] 
                || navigator.plugins["Shockwave Flash"]){

                        var isVersion2 = navigator.plugins["Shockwave Flash
2.0"] ? " 2.0" : "";
                        var flashDescription = navigator.plugins["Shockwave
Flash" + isVersion2].description;
                        var flashVersion =
parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

                        flash2Installed = flashVersion == 2;            
                        flash3Installed = flashVersion == 3;
                        flash4Installed = flashVersion == 4;
                        flash5Installed = flashVersion == 5;
                }
        }
        
        for (var i = 2; i <= maxVersion; i++) { 
                if (eval("flash" + i + "Installed") == true) actualVersion =
i;
        }

        if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;


        if (actualVersion >= requiredVersion) {
                hasRightVersion = true;


                if (useRedirect) {

                        if(jsVersion > 1.0) {
                        <cfif IsDefined("cookie.SeenSplash")>
                                window.location = 'frame_setup.html';
                        <cfelse>
                                window.open('intro/main_intro.html',
'intro', 'width=720,height=400,scrollbars=no,LEFT=50,TOP=50');
                        </cfif>
                } else {
                                window.location = flashPage;            
                        }
                }
        } else {        
        
                if (useRedirect) {              
                        if(jsVersion > 1.0) {   
                                window.location.replace((actualVersion >= 2)
? upgradePage : noFlashPage);
                        } else {
                                window.location = (actualVersion >= 2) ?
upgradePage : noFlashPage;
                        }
                }
        }
}


detectFlash();          
        
// -->
</SCRIPT>

<cfcookie name="SeenSplash" value="Yes" expires="NEVER">



</HEAD>

<BODY BGCOLOR="#FFFFFF">
<BR>
<BR>
<BR>
<BR>
<BR
>
<BR>
<BR>
<BR>
<BR>
<CENTER>
<A HREF="frame_setup.html"><IMG SRC="images/logo_blackback2.gif" WIDTH="324"
HEIGHT="31" ALT="" BORDER="0"></A><BR>
</CENTER>
<!--############################################################
        IF YOU'RE USING PAGE REDIRECTION, FOLLOW THESE INSTRUCTIONS
        1) put some content here to tell the user what's going on
        while they wait. something like:
        "detecting macromedia flash, please wait..."

        2) delete everything below this point up to
        the end body tag </BODY>
        ############################################################-->





<!--########################################################################
####
        IF YOU'RE USING CONTENT SWAPPING, ADJUST THE SCRIPT BELOW TO SUIT
YOUR NEEDS

############################################################################
-->

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--
// in this section we set up the content to be placed dynamically on the
page
// customize movie tags and alternate html content below

if (!useRedirect) {             // if dynamic embedding is turned on
        if(hasRightVersion) {   // if we've detected an acceptable version
                var oeTags = '<OBJECT
CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
                + 'WIDTH="550" HEIGHT="400"'
                +
'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c
ab">'
                + '<PARAM NAME="MOVIE" VALUE="movie.swf">'
                + '<PARAM NAME="PLAY" VALUE="true">'
                + '<PARAM NAME="LOOP" VALUE="false">'
                + '<PARAM NAME="QUALITY" VALUE="high">'
                + '<PARAM NAME="MENU" VALUE="false">'
                + '<EMBED SRC="movie.swf"'
                + 'WIDTH="550" HEIGHT="400"'
                + 'PLAY="true"'
                + 'LOOP="false"'
                + 'QUALITY="high"'
                + 'MENU="false"'
                + 'TYPE="application/x-shockwave-flash"'
                +
'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod
_Version=ShockwaveFlash">'
                + '</EMBED>'
                + '</OBJECT>';

                document.write(oeTags);         // embed the flash movie
        } else {        // flash is too old or we can't detect the plugin
                var alternateContent = '<IMG SRC="altimage.gif" HEIGHT="400"
WIDTH="550">'   // height, width required!
                        + '<BR>any desired alternate html code goes here';

                document.write(alternateContent);       // insert non-flash
content
        }
}

// -->
</SCRIPT>

<NOSCRIPT>
<!--########################################################################
####
        HERE WE PROVIDE ALTERNATE CONTENT FOR NON-SCRIPT-SUPPORTING BROWSERS
        OR BROWSERS THAT HAVE THEIR SCRIPTING TURNED OFF...

############################################################################

        IF YOU ARE USING PAGE REDIRECT, A META REFRESH GOES HERE. FOR
EXAMPLE:
        <META HTTP-EQUIV="Refresh" CONTENT="10;URL=noflash.html">

        IF YOU ARE USING CONTENT SWAPPING, THE VALUE OF THE alternateContent
VARIABLE
        SHOULD BE REPEATED HERE. FOR EXAMPLE:
        <IMG SRC="altimage.gif" HEIGHT="400" WIDTH="550">

        -->
</NOSCRIPT>



</BODY>
</HTML>

-----Original Message-----
From: Andrew Tollervey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 7:33 AM
To: Fusebox
Subject: Re: Flash/coldfusion question


Hello,

Does anyone have example code that does the following:

<IF FLASH PLUGIN IS DETECTED>
Play flash
<ELSE>
Display an Image

I know this will probably have to be JavaScript, but do people think it's a
good idea for the result of the JavaScript to be sent back to Coldfusion to
be added to a session variable?
<cfif NOT CompareNoCase(session.flash, "Yes")>
<cfmodule template="dsp_flash.cfm" movie="hello">
<cfelse>
<cfmodule template="dsp_AltFlashImage.cfm" image="hello">
</cfif>

Thanks,

Andrew
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to