cnr_ul trans1x1 cnr_ur
trans1x1
trans1x1
   
 search 
trans1x1
trans1x1
trans1x1
Home > >


Tools : Flash Detector,
 

The Code :

<script language="VBScript">
<!--
    //
    // First : Detect ActiveX control
    //
    Function VBGetFlashVer(fVer)

    on error resume next

    Dim sFlashControl, sFlashVersion
    sFlashVersion = "0.0"

    set sFlashControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(fVer))

    if (IsObject(sFlashControl)) then
      sFlashVersion = CStr(fVer)
      sFlashVersion = CStr(sFlashControl.FlashVersion(""))
      end if

    VBGetFlashVer = sFlashVersion

    End Function
// -->
</script>


<script language="javascript">
<!--
    /**
    * Second : buildup the detector
    */
    var iStepValue = 10; // Iteration cycles - ref : fTheMinVersion plus this value
    var fTheMinVersion = 3; // Minimum 'Required' Flash verson.

    var sTheMaxVersion = (parseInt(iStepValue + fTheMinVersion)); // Maximum loop - counter
    var bIsMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
    var bIE4plus = (document.all) ? true : false;
    var bNN4plus = (document.layers) ? true : false;
    var bPlugin = false;
    var bWin = (navigator.platform.toLowerCase().indexOf("win") != -1) ? true : false;
    var oTheMovie = "", sVB = "", sIsActiveX = "", sNoFlash = "", sPluginDescription = "";


    function flashDetectAxVer(reqVer) {

      if (bIE4plus && bWin) {

        for (var i = sTheMaxVersion; i >= 0; i--) { // loop backwards through the major version values
          for (var h = 0; h < 10; h++){ // loop forward through the minor version values

            versionString = VBGetFlashVer(parseFloat( i + "." + h ))

            if (versionString != "0.0") {
              // if we get 1.0 we assume it is actually 6.0
              versionNum = (versionString == "1.0" ? 6.0 : parseFloat(versionString))
              return (reqVer ? ((fTheMinVersion >= versionNum ) ? true : false) : versionNum)
            }
          }
        }
      }
    return (reqVer ? false : 0.0);
    }


    /**
    * Third : check for plugins
    */
    if (navigator.mimeTypes
    && navigator.mimeTypes["application/x-shockwave-flash"]
    && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {

      if (navigator.plugins) // check for version
        var sPluginID = navigator.plugins["Shockwave Flash"].description;
        sPluginID.substr(sPluginID.indexOf("Shockwave Flash")+16,3) >= fTheMinVersion ? bPlugin = true : bPlugin = false;

        // show the app name and plug-in version
        sPluginDescription = "<ul>" + navigator.appName + " plug-in : "
        + navigator.plugins["Shockwave Flash"].description + "</ul>";
      }
    // Browser uses ActiveX Control - test; can we create the obj ? true:false
    else if (bIE4plus && !bIsMac){

      var sFlashControl = flashDetectAxVer(fTheMinVersion);

      if (sFlashControl && (parseFloat(versionString) >= fTheMinVersion)){
        bPlugin = true;
        sPluginDescription = "<ul>" + navigator.appName + ", Flash Control version: " + versionString + "</ul>";
      }
    }
//-->
</script>


<script language="javascript">
<!--
    /**
    * Fourth : build and write output string(s)
    */
    function doFlashValidation(){

      if ( bPlugin ) { // Once we've validated we're Flash capabile we can buildup our movie string.

      var theURL = "http://www.3dasa.com/flash/3dasa_intro.swf";

      oTheMovie += '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
      oTheMovie += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab';
      oTheMovie += '#version=5,0,0,0" WIDTH=400 HEIGHT=33>';
      oTheMovie += ' <PARAM NAME=movie VALUE="' + theURL + '">';
      oTheMovie += ' <PARAM NAME=loop VALUE=false>';
      oTheMovie += ' <PARAM NAME=quality VALUE=high>';
      oTheMovie += ' <EMBED src="' + theURL + '" loop=false quality=high WIDTH=400 HEIGHT=33 ';
      oTheMovie += 'TYPE="application/x-shockwave-flash" ';
      oTheMovie += 'PLUGINSPAGE="http://www.macromedia.com/shockwave/';
      oTheMovie += 'download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
      oTheMovie += '</EMBED>';
      oTheMovie += '</OBJECT>';

    document.write( oTheMovie );

    }
    // Flash compability is limited or nonexistant - so let's provide an exit with a Flash upload option.
    // This is generally where you might place a 'document.replace(theReplacementFile) command.'

    else if (!(navigator.appName
    && navigator.appName.indexOf("Netscape") >= 0
    && navigator.appVersion.indexOf("2.") >= 0)){

      sNoFlash += '<div><font class="clrWhite">Movie does not support version ';
      sNoFlash += '<font class="clrRed">' + fTheMinVersion + '</font> of Flash player</font></div>';
      sNoFlash += '<img src="http://www.3dasa.com/products/soniccruiser/movie_stars/sc10070.jpg">';
      sNoFlash += '<div><a href="http://www.macromedia.com/shockwave/download/';
      sNoFlash += 'index.cgi?P1_Prod_Version=ShockwaveFlash" class="clrWhite">Get Flash : ';
      sNoFlash += '<img src="../images/go_btn.gif" border="0"></a></div>';

    document.write( sNoFlash );
    }
}
//-->
</script>







----------------------------------------------------------------------------------
Finally : call our JavaScript function to make it happen.

    place this on the web page where you want your movie to be.
<!-- Check for and load Flash movie - if possible -->
<script language="javascript">doFlashValidation()</script>
----------------------------------------------------------------------------------




 
 
North Bend, WA. - USA
 
trans1x1
cnr_ll trans1x1 cnr_lr
trans1x1

copyright © 2001-2003, Ken Workman