Detect Flash Player Version; Install/Upgrade if necessary

I've seen this asked and answered a number of different ways, but I can't make any of the examples work for myself. I need to:
1) Detect the user's Flash Player version
2) Express Install/Upgrade to new version if necessary
3) Ensure that Dreamweaver's JavaScript Active Content workaround is in place (no click/space bar to use controls)
4) Begin playing the SWF

None of Adobe's Flash Player Detection Kit instructions or example files seem to work at all for me - let alone accomplishing all of the above. I know many of you probably do this every day. Would someone please please help?? I'm "just a designer..." :)

My current code, taken from the published Flash8 HTML file, is included below. Let me know if you need any other information. Thanks!!
-----

<!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>bcam_video</title>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------
// -->
</script>
<script language="VBScript" type="text/vbscript">
<!-- // Visual basic helper required to detect Flash Player ActiveX control version information
Function VBGetSwfVer(i)
  on error resume next
  Dim swControl, swVersion
  swVersion = 0
 
  set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))
  if (IsObject(swControl)) then
    swVersion = swControl.GetVariable("$version")
  end if
  VBGetSwfVer = swVersion
End Function
// -->
</script>
<script language="JavaScript1.1" type="text/javascript">
<!-- // Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
      // NS/Opera version >= 3 check for Flash plugin in plugin array
      if (navigator.plugins != null && navigator.plugins.length > 0) {
            if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
                  var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                  var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
                  descArray = flashDescription.split(" ");
                  tempArrayMajor = descArray[2].split(".");
                  versionMajor = tempArrayMajor[0];
                  versionMinor = tempArrayMajor[1];
                  if ( descArray[3] != "" ) {
                        tempArrayMinor = descArray[3].split("r");
                  } else {
                        tempArrayMinor = descArray[4].split("r");
                  }
                  versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
            } else {
                  flashVer = -1;
            }
      }
      // MSN/WebTV 2.6 supports Flash 4
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
      // WebTV 2.5 supports Flash 3
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
      // older WebTV supports Flash 2
      else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
      // Can't detect in all other cases
      else {
            
            flashVer = -1;
      }
      return flashVer;
}
// If called with no parameters this function returns a floating point value
// which should be the version of the Flash Player or 0.0
// ex: Flash Player 7r14 returns 7.14
// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
       reqVer = parseFloat(reqMajorVer + "." + reqRevision);
         // loop backwards through the versions until we find the newest version      
      for (i=25;i>0;i--) {      
            if (isIE && isWin && !isOpera) {
                  versionStr = VBGetSwfVer(i);
            } else {
                  versionStr = JSGetSwfVer(i);            
            }
            if (versionStr == -1 ) {
                  return false;
            } else if (versionStr != 0) {
                  if(isIE && isWin && !isOpera) {
                        tempArray         = versionStr.split(" ");
                        tempString        = tempArray[1];
                        versionArray      = tempString .split(",");                        
                  } else {
                        versionArray      = versionStr.split(".");
                  }
                  versionMajor      = versionArray[0];
                  versionMinor      = versionArray[1];
                  versionRevision   = versionArray[2];
                  
                  versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
                  versionNum        = parseFloat(versionString);
              // is the major.revision >= requested major.revision AND the minor version >= requested minor
                  if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
                        return true;
                  } else {
                        return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );      
                  }
            }
      }      
      return (reqVer ? false : 0.0);
}
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<script language="JavaScript" type="text/javascript">
<!--
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) {  // if we've detected an acceptable version
    var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + 'width="250" height="230"'
    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<param name="movie" value="bcam_video.swf" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'
    + '<embed src="bcam_video.swf" loop="false" quality="high" bgcolor="#ffffff" '
    + 'width="250" height="230" name="bcam_video" align="middle"'
    + 'play="true"'
    + 'loop="false"'
    + 'quality="high"'
    + 'allowScriptAccess="sameDomain"'
    + 'type="application/x-shockwave-flash"'
    + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    + '<\/embed>'
    + '<\/object>';
    document.write(oeTags);   // embed the flash movie
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here.'
        + 'This content requires the Macromedia Flash Player.'
         + '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
// -->
</script>
<noscript>
      // Provide alternate content for browsers that do not support scripting
      // or for those that have scripting disabled.
        Alternate HTML content should be placed here. This content requires the Macromedia Flash Player.
        <a href="http://www.macromedia.com/go/getflash/">Get Flash</a>        
</noscript>
</body>
</html>
LVL 4
slovisaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dushan De SilvaTechnology ArchitectCommented:
1.) File --> Publish Settings --> HTML --> Template --> select "Detect for Flash 6"
0
Jakob_ECommented:
Hi,

Have a look at SWFObject - It does all you want :)
Link:          http://blog.deconcept.com/swfobject/
Download: http://blog.deconcept.com/swfobject/swfobject1-4.zip

Best,
Jakob E

0
slovisaAuthor Commented:
Dushan, I have tried to publish withe the Detect option checked, but it doesn't accomplish all of the above goals.

Jakob, this sounds like the perfect solution, but I haven't been able to make it work. Maybe I'm over-simplifying it - I simply added this to the header:
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->
<script type="text/javascript" src="swfobject.js"></script>

Then added this where my Flash object goes:
      <div id="flashcontent">
            This content requires the Macromedia Flash Player.<br />
            <a href="http://www.adobe.com/go/getflashplayer">Click here to Get Flash.</a>
      </div>

      <script type="text/javascript">
            // <![CDATA[
            var so = new SWFObject("bcam_video.swf", "bcam_video", "250", "230", "8.0.0", "#FFFFFF", true);
            so.write("flashcontent");
            // ]]>
      </script>

(And of course added the swfobject.js file to my server)

That's not working for me at all. What am I doing wrong?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

slovisaAuthor Commented:
If anyone can tell me how to implement SWFObject to:
1) Detect the user's Flash Player version
2) *Express Install/Upgrade* to new version if necessary
3) *Display alternate content* to users who can't Express Install
3) Begin playing the SWF, *including the active content workaround* (no click/space bar to use controls)

The points are all yours. Please help!
0
Jakob_ECommented:
Hmmm

Have you looked at the expressinstall.html and flashversion.html
both included in the zip file... They works on my pc (ie + firefox)

~ Jakob
0
slovisaAuthor Commented:
Yes. Here's exactly what I've done:

1) Copied to my header:
<script type="text/javascript" src="swfobject.js"></script>


2) Copied to the body, where my swf should appear:
<div id="flashcontent">
This page requires the Macromedia Flash Player.<br>
<a href="http://www.macromedia.com/go/getflash/" target="_blank">Get Flash</a>
</div>
<script type="text/javascript">
   var so = new SWFObject("bcam_video.swf", "bcam_video", "250", "230", "8", "#FFFFFF");
   so.write("flashcontent");
</script>


3) Copied to the first frame of my SWF (no other content on frame 1):
#include "expressinstall.as"

// initialize the ExpressInstall object
var ExpressInstall = new ExpressInstall();

// if the user needs to upgrade, show the 'start upgrade' button
if (ExpressInstall.needsUpdate) {

     // this is optional, you could also automatically start the
     // upgrade by calling ExpressInstall.init() here instead of the following lines

     // attach the custom upgrade message and center it
     var upgradeMsg = attachMovie("upgradeMsg_src", "upgradeMsg", 1);
     upgradeMsg._x = Stage.width / 2;
     upgradeMsg._y = Stage.height / 2;

     // attach the button actions that will start the ExpresInstall updater
     upgradeMsg.upgradeBtn.onRelease = function() {
          // the ExpressInstall.init() method is what kicks off the actual update
          ExpressInstall.init();
     }
     // if expressinstall is invoked, stop the timeline.
     stop();
}


4) Copied expressinstall.as and swfobject.js to my web server.

The results: I get a big blank box in IE6, and I get the alternate content in Firefox - And I have Player9 installed...

Any idea what I'm doing wrong? Thanks for your help.
0
ch2Commented:
try like this. The script must reside inside the flashcontent.

<div id="flashcontent">
This page requires the Macromedia Flash Player.<br>
<a href="http://www.macromedia.com/go/getflash/" target="_blank">Get Flash</a>

<script type="text/javascript">
   var so = new SWFObject("bcam_video.swf", "bcam_video", "250", "230", "8", "#FFFFFF");
   so.write("flashcontent");
</script>
</div>
0
slovisaAuthor Commented:
The SWFObject embed alone seems to work whether the JS is inside or outside the DIV, since it's targeting the DIV anyway. Adding the Express Install is where I'm running into trouble.
0
ch2Commented:
Well yesterday i installed it following these instructions and it worked out. So should work for you to.

http://blog.deconcept.com/swfobject/#expressinstall
0
ch2Commented:
Also make sure to read the notes like next one:

It's important to not place any content on the first frame (or wherever your ExpressInstall check happens) that requires Flash player 7 or higher.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slovisaAuthor Commented:
Ultimately the SWFObject solution was implemented correctly, but the swf was missing a stop action on the final frame...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.