NativeApplication.nativeApplication.runtimeVersion
returns the runtime version, but what is the best way to create a function which will return the major version?
For version 2.6.0.19120, the function should return 2 only. This function should work even wh开发者_如何学编程en AIR reaches version 10.
A future safe (for both AIR and your code, which might need the minor number):
var versionNumbers:Array = NativeApplication.nativeApplication.runtimeVersion.split(".");
var versionMajor:String = versionNumbers[0] as String;
Clamp to first point:
var version:String = NativeApplication.nativeApplication.runtimeVersion;
version = version.substring(0, version.indexOf("."));
精彩评论