?
Solved

Flash detection using getVersion

Posted on 2006-11-15
11
Medium Priority
?
370 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

777 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