Solved

Flash detection using getVersion

Posted on 2006-11-15
11
369 Views
Last Modified: 2011-10-03
Hi.

I have a setup that uses a page with a swf to determine wheather or not the user has the right Flash version or not and then re-direct them accordingly. When I tested locally changing my parameters for the required version it all worked fine, but when I switched to live testing it does not work the way it should. I think maybe I've done something wrong with the logical operators but then again they should be tha same no matter if you run locally or not.

This is my setup:
index.html - runs the swf that checks the Flash version
main.html - if the requirements are fulfilled go here
flash-update.html - if the requirements lack go here

http://www.andreasgustavsson.com/ee

This is my actionscript:

/* Detect the user's operating system platform and
Flash Player version and then break that info down into
usable variables and [arrays]*/

//Get system info and make string lower case
vSystemInfo = getVersion().toLowerCase();
//Break string into usable pieces
vTempString1 = vSystemInfo.split(",", 1);
vTempString2 = vTempString1[0].split(" ", 2);
//Extract Platform
vPlatform = vTempString2[0];
//Extract Major Version eg. 8
vVersionMajor = vTempString2[1];
//Extract Minor Version eg. (8).0.22.0
vVersionMinor = vSystemInfo.split(",", 4);

//Set minimum conditions
vWinMajorMin = 8;
vWinMinorMin1 = 0;
vWinMinorMin2 = 20;
vWinMinorMin3 = 0;

vMacMajorMin = 8;
vMacMinorMin1 = 0;
vMacMinorMin2 = 20;
vMacMinorMin3 = 0;

vUnixMajorMin = 9;
vUnixMinorMin1 = 0;
vUnixMinorMin2 = 0;
vUnixMinorMin3 = 0;

//Compare results and redirect to correct html page
if (vPlatform == "win") {
      if (vVersionMajor >= vWinMajorMin && vVersionMinor[1] >= vWinMinorMin1
            && vVersionMinor[2] >= vWinMinorMin2 && vVersionMinor[3] >= vWinMinorMin3) {
            getURL("main.html", "_self");
      } else getURL("flash-update.html", "_self");
}

if (vPlatform == "mac") {
      if (vVersionMajor >= vMacMajorMin && vVersionMinor[1] >= vMacMinorMin1
            && vVersionMinor[2] >= vMacMinorMin2 && vVersionMinor[3] >= vMacMinorMin3) {
            getURL("main.html", "_self");
      } else getURL("flash-update.html", "_self");
}

if (vPlatform == "unix") {
      if (vVersionMajor >= vUnixMajorMin && vVersionMinor[1] >= vUnixMinorMin1
            && vVersionMinor[2] >= vUnixMinorMin2 && vVersionMinor[3] >= vUnixMinorMin3) {
            getURL("main.html", "_self");
      } else getURL("flash-update.html", "_self");
}

I hope that someone can help me with a quick sollution to this, will reward 500 points.

Cheers,
Andreas.
0
Comment
Question by:iamcmag
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
11 Comments
 
LVL 5

Expert Comment

by:blockage1
ID: 17955446
The quick solution would be to use SWFObject instead. http://blog.deconcept.com/swfobject/

This can also enable express install and will fix the IE active-x activation bug.

The only downside is users need javascript - but users who turn that off probably dont care about flash anyway.
0
 

Author Comment

by:iamcmag
ID: 17974439
Hi blockage1.

That is one way to do it and it's maybe even a better way. I will look into using this technique later, however right now I want get my current script working and not switch to using another technique. I'm still looking for an answer to the question at hand.

Please testrun the page and have a look at the script.

/Andreas
0
 
LVL 5

Expert Comment

by:blockage1
ID: 17979650
I don't have flash on the machine I'm on right now so I can test this but... I'm pretty sure when you use split() you end up with an array of strings - you might need to recast the results to Numbers before you can evaluate them.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:iamcmag
ID: 17986791
I've sorted it myself. There were problems with my logical comparison of the users version and the specified parameters, I'd overlooked several possibilities. The values works fine as variables though, no problems to compare them as integers. Everything works fine now.

/Andreas
0
 
LVL 5

Expert Comment

by:blockage1
ID: 17987677
Next time then. good luck,
b
0
 

Author Comment

by:iamcmag
ID: 17987734
No worries!

Script revision:

/* Detect the user's operating system platform and
Flash Player version and then break that info down into
usable variables and [arrays]*/

//Get system info and make string lower case
vSystemInfo = getVersion().toLowerCase();
//Break string into usable pieces
vTempString1 = vSystemInfo.split(",", 1);
vTempString2 = vTempString1[0].split(" ", 2);
//Extract Platform
vPlatform = vTempString2[0];
//Extract Major Version eg. 8
vVersionMajor = vTempString2[1];
//Extract Minor Version eg. (8).0.22.0
vVersionMinor = vSystemInfo.split(",", 4);

//Set minimum conditions
vWinMajorMin = 8;
vWinMinorMin1 = 0;
vWinMinorMin2 = 20;
vWinMinorMin3 = 0;

vMacMajorMin = 8;
vMacMinorMin1 = 0;
vMacMinorMin2 = 20;
vMacMinorMin3 = 0;

vUnixMajorMin = 9;
vUnixMinorMin1 = 0;
vUnixMinorMin2 = 0;
vUnixMinorMin3 = 0;

//Compare results and redirect to correct html page
if (vPlatform == "win") {
      if ((vVersionMajor > vWinMajorMin) || (vVersionMajor >= vWinMajorMin && vVersionMinor[1] > vWinMinorMin1)
            || (vVersionMajor >= vWinMajorMin && vVersionMinor[1] >= vWinMinorMin1) && (vVersionMinor[2] > vWinMinorMin2)
            || (vVersionMajor >= vWinMajorMin && vVersionMinor[1] >= vWinMinorMin1) && (vVersionMinor[2] >= vWinMinorMin2)
            && (vVersionMinor[3] >= vWinMinorMin3)) {
            getURL("main.html", "_self");
      } else
      getURL("flash-update.html", "_self");
}

if (vPlatform == "mac") {
      if ((vVersionMajor > vMacMajorMin) || (vVersionMajor >= vMacMajorMin && vVersionMinor[1] > vMacMinorMin1)
            || (vVersionMajor >= vMacMajorMin && vVersionMinor[1] >= vMacMinorMin1) && (vVersionMinor[2] > vMacMinorMin2)
            || (vVersionMajor >= vMacMajorMin && vVersionMinor[1] >= vMacMinorMin1) && (vVersionMinor[2] >= vMacMinorMin2)
            && (vVersionMinor[3] >= vMacMinorMin3)) {
            getURL("main.html", "_self");
      } else
      getURL("flash-update.html", "_self");
}

if (vPlatform == "unix") {
      if ((vVersionMajor > vUnixMajorMin) || (vVersionMajor >= vUnixMajorMin && vVersionMinor[1] > vUnixMinorMin1)
            || (vVersionMajor >= vUnixMajorMin && vVersionMinor[1] >= vUnixMinorMin1) && (vVersionMinor[2] > vUnixMinorMin2)
            || (vVersionMajor >= vUnixMajorMin && vVersionMinor[1] >= vUnixMinorMin1) && (vVersionMinor[2] >= vUnixMinorMin2)
            && (vVersionMinor[3] >= vUnixMinorMin3)) {
            getURL("main.html", "_self");
      } else
      getURL("flash-update.html", "_self");
}

Maybe someone else can find this script useful. By adding an additional JS to the HTML page that checks for Flashplayer this works quite well for most situations. The only thing missing is the auto update feature.

Regards,
Andreas.
0
 
LVL 5

Expert Comment

by:blockage1
ID: 18011766
I'm happy
0
 

Author Comment

by:iamcmag
ID: 18011800
To blockage1, I asked Community Support to give you 200 points for your quick input even though it was not the final sollution, it seems lika a good technique I did not know about. However I'm not sure that they can.

Regards,
Andreas.
0
 
LVL 5

Expert Comment

by:blockage1
ID: 18011848
Thanks Andreas
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18027766
PAQd, 500 points refunded.

DarthMod
CS Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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 …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

726 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