Solved

Flash detection using getVersion

Posted on 2006-11-15
11
366 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
  • 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWAY 3d Using BitMapCubeTexture 1 408
Adobe Flash Free Transform Tool 2 139
High Internet Explorer CPU on Flash site in Citrix 2 807
Flash Player Action Script Error 1090 5 207
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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 how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

809 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