SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Flash Detect and Upgrade

    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?

  2. #2
    SitePoint Zealot flashswami's Avatar
    Join Date
    Jun 2002
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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");
      }
    }
    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.
    FlashSwami //Flash & server side fun
    DotDragNet //General web help
    [>Now available for freelance web work<]

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2000
    Location
    CT
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is that code above a javascript? That goes into the headers?

  4. #4
    SitePoint Zealot webQS's Avatar
    Join Date
    Oct 2002
    Location
    Sydney : Australia
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stevek
    Is that code above a javascript? That goes into the headers?
    That code is ActionScript.


    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.

    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");
    		}
    }
    This is the code from my server side detection experiment linked in my footer below.

    - 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •