Search code examples
actionscript-3apache-flexairadobeflash-builder

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.


Solution

  •   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);