Get the environment of the player
// Create an environment object;
var environment:Object = new Object();
// Get player type
// Non-IE: "PlugIn"
// IE: "ActiveX"
environment.playerType = Capabilities.playerType;
// Get's the current domain
var lc:LocalConnection = new LocalConnection();
environment.domain = lc.domain;
// Get the player’s version by using the flash.system.Capabilities class.
environment.fullVersion = Capabilities.version;
// The version number is a list of items divided by “,”
var versionArray:Array = environment.fullVersion.full.split(",");
var length:Number = versionArray.length;
// The main version contains the OS type too so we split it in two
// and we’ll have the OS type and the major version number separately.
var platformAndVersion:Array = versionArray[0].split(" ");
environment.platform = platformAndVersion[0];
environment.majorVersion = parseInt(platformAndVersion[1]);
environment.minorVersion = parseInt(versionArray[1]);
environment.buildNumber = parseInt(versionArray[2]);
trace("Player Type: " + environment.playerType);
trace("Current Domain: " + environment.domain);
trace("Platform: " + environment.platform);
trace("Full Version: " + environment.fullVersion);
trace("Major version: " + environment.majorVersion);
trace("Minor version: " + environment.minorVersion);
trace("Build number: " + environment.buildNumber);
_environment = environment;
Written by Jeremy Dowell
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Game development
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#