/ Published in: ActionScript 3
This code separates out the Flash Player Platform, Major Version number and Minor Version numbers.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import flash.system.Capabilities; var flashPlayerMajorVersion:int; trace("Getting Flash Player version ..."); var versionString:String = Capabilities.version; var pattern:RegExp = /^(\w*) (\d*),(\d*),(\d*),(\d*)$/; var result:Object = pattern.exec(versionString); if (result != null) { trace("input: " + result.input); trace("platform: " + result[1]); flashPlayerMajorVersion = int(result[2]); trace("flashPlayerMajorVersion: " + flashPlayerMajorVersion); trace("minorVersion: " + result[3]); trace("buildNumber: " + result[4]); trace("internalBuildNumber: " + result[5]); } else { trace("Unable to match RegExp."); } // Example output ... // // Getting Flash Player version ... // input: WIN 10,1,52,14 // platform: WIN // flashPlayerMajorVersion: 10 // minorVersion: 1 // buildNumber: 52 // internalBuildNumber: 14