Propeller
Propeller

Reputation: 2533

Detect versionNumber from MyProject-App.xml? Adobe AIR

The desktop application I'm working on is being developed in Adobe AIR + Flex + As3. Now I want to detect the versionNumber parameter on the accompanying XML description file for the AIR app.

<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade. 
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
<versionNumber>1.0.0</versionNumber>

Is there a variable or property that I can use to access this? For example in the About box of the app, instead of manually editing the version displayed, I want it to rely on this one.

Upvotes: 5

Views: 4166

Answers (3)

medlinetec
medlinetec

Reputation: 11

If you want to use not just numbers - 2.1.1 - and put alpha/beta... you must use the "versionLabel" not the "versionNumber"

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

Upvotes: 0

rejo
rejo

Reputation: 3350

  var appXML:XML =  NativeApplication.nativeApplication.applicationDescriptor;

you can parse version number from this xml , like this

var ns:Namespace = appXML.namespace();
trace(appXML.ns::versionNumber);

Upvotes: 12

Azzy Elvul
Azzy Elvul

Reputation: 1438

You can use applicationDescriptor property from NativeApplication class to get the application descriptor xml http://help.adobe.com/en_US/air/reference/html/flash/desktop/NativeApplication.html

Upvotes: 1

Related Questions