zabar
zabar

Reputation: 81

Find my air application version in AS3 on iOS and Android

Is there an as3 API in Air (I'm using 3.2) to access my application version ? The one I give on the App Store or Android Market ?

Upvotes: 7

Views: 2665

Answers (3)

mika
mika

Reputation: 1451

Looks like it's different for Air 4.0 This worked for me:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespace();
var version:String = descriptor.ns::versionNumber;

Upvotes: 3

posit labs
posit labs

Reputation: 9431

var _descriptor:XML = nativeApplication.applicationDescriptor;
var ns:Namespace = _descriptor.namespace();
var version:String = _descriptor.ns::versionNumber;

This is what works for me. "descriptor" var is used in AIR 3.2 for a UIComponentDescriptor, so I couldn't use that variable name. Also, statically accessing nativeApplication (NativeApplication.nativeApplication) gave me a null pointer reference, so I just grabbed it directly.

Lastly, versionNumber is what stores the version in AIR 3.2.

Upvotes: 2

francis
francis

Reputation: 6349

Yeah you can pull it directly from the application xml descriptor. Something like this should work:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespace();
var version:String = descriptor.ns::version[0];

Upvotes: 8

Related Questions