Home : Adobe : Flash : Actionscript : 3 : Get Player Version

Get User's Flash Player Version

This function creates an object containing the end user's operating system and Flash Player version. The object includes the following values:

 
var flashVersion:Object = new Object();// Object to hold the Flash version details
 
function getPlayerVersion() {
   var versionNumber:String = Capabilities.version;// Get the whole version string
   var versionArray:Array = versionNumber.split(",");// Split it up
   var length:Number = versionArray.length;
   var osPlusVersion:Array = versionArray[0].split(" ");// The main version contains the OS (e.g. WIN), so we split that off as well.
   // Populate the version object (the OS is a string, others are numbers):
   flashVersion["os"] = osPlusVersion[0];
   flashVersion["major"] = parseInt(osPlusVersion[1]);
   flashVersion["minor"] = parseInt(versionArray[1]);
   flashVersion["build"] = parseInt(versionArray[2]);
   // Test the output:
   trace(flashVersion["os"]);
   trace(flashVersion["major"]);
   trace(flashVersion["minor"]);
   trace(flashVersion["build"]);
}