Search code examples
xmlapache-flexactionscript-3airair2

how can I read the version from application descriptor file


So I have a basic application descriptor file for my AIR app. It looks something like this, shortened for sanity:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/2.0">
  <version>1.0.10</version>
</application>

Now I want in the application to display the version, but I don't want to have to maintain the version in multiple places, so how can I read that version number from within the application?


Solution

  • Check the following code:

                var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
                var ns:Namespace = appXml.namespace(); 
                trace(appXml.ns::version);