7

Air 中是否有 as3 API(我使用的是 3.2)来访问我的应用程序版本?我在 App Store 或 Android Market 上提供的那个?

4

3 回答 3

8

是的,您可以直接从应用程序 xml 描述符中提取它。像这样的东西应该工作:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespace();
var version:String = descriptor.ns::version[0];
于 2012-04-17T19:56:12.593 回答
3

看起来 Air 4.0 有所不同这对我有用:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespace();
var version:String = descriptor.ns::versionNumber;
于 2013-12-16T18:29:59.590 回答
2
var _descriptor:XML = nativeApplication.applicationDescriptor;
var ns:Namespace = _descriptor.namespace();
var version:String = _descriptor.ns::versionNumber;

这对我有用。“descriptor” var 在 AIR 3.2 中用于 UIComponentDescriptor,因此我不能使用该变量名。还有,静态访问nativeApplication(NativeApplication.nativeApplication)给了我一个空指针引用,所以我就直接抓取了。

最后,versionNumber 将版本存储在 AIR 3.2 中。

于 2012-08-26T18:00:42.230 回答