Is there a way to program an autodetect that will check to make sure a user has at least version 5 of flash. If they do not have that version then link them to the upgrade on macromedias site?
| SitePoint Sponsor |
Is there a way to program an autodetect that will check to make sure a user has at least version 5 of flash. If they do not have that version then link them to the upgrade on macromedias site?
This will work- it does more than major version detection. If needs be it can be configured to act on the platform detected or take account of the monior build too.Code:on(release){ version= getVersion(); space=version.indexOf(" "); myString=version.substring(space+1,version.lemgth); myArray=myString.split(","); player= new Object(); player.platform=version.substring(0,space); player.majorVersion=parseInt(myArray[0]); player.minorVersion=parseInt(myArray[1]); player.buildNo=parseInt(myArray[2]); player.patchNo=parseInt(myArray[3]); if (player.majorVersion <= 5){ getURL(flash5site.html"); }else{ getURL(flash6site.html"); } }
FlashSwami //Flash & server side fun
DotDragNet //General web help
[>Now available for freelance web work<]

Is that code above a javascript? That goes into the headers?

That code is ActionScript.Originally Posted by stevek
There are a few ways to accomplish this -
- use inbuilt version detection in Flash Actionscript to get the version number and then go to the required frame, scene or other html page.
This needs to be done carefully as Flash Player 2, 3 and 4 may baulk at the dot syntax..
$version was introduced in 4.0r11, version was introduced in 5 and capabilities object was intro'd in Fp6.
Here's the way I did it to check for a minimum of 5.
Put this in frame 1 of scene 1 and the function on another layer on the same timeline. This works for 3, 4, 5 and 6. FP2 gives up.
This is the code from my server side detection experiment linked in my footer below.Code://Flash Player 4 doesn't like >= operator //so set minimum to 5 minimumVersion = 5; installedVersion = getVersion(); if(installedVersion == "") { gotoAndStop("upgrade"); } else { checkPlayerAgainst(minimumVersion, installedVersion); } //then the function function checkPlayerAgainst(requiredPlayerVersion, thisPlayerId) { //----- first get the user's player information -------// //make an array of this player's version numbers thisVer = thisPlayerId.split(","); //get rid of the gunk before the major player version number //e.g WIN 6 etc thisVerSpaceNum = thisVer[0].indexOf(" "); thisMajorVer = Number(thisVer[0].substr(thisVerSpaceNum)); //-------------------------------------------------// if(thisPlayerId == false) { //play the upgrade information gotoAndStop("upgrade"); } else if(thisMajorVer > requiredPlayerVersion) { //play the movie gotoAndStop("init"); } else { //play the upgrade information gotoAndStop("upgrade"); } }
- next is javascript and vbscript and is probably the most useful. In Javascript, simply check for the required entry in the navigator.plugins field and redirect if the minimum version is not present. In VBScript try to create a Shockwave Flash object of the correct version (will return true/false depending on success).
Make sure if you check for 5 that you allow 6
Check the script on my homepage to see how I do it... my vbscript is a bit dodgy tho....
HTH
james
Bookmarks