Okey, so here’s the problem: I’ve got this Adobe Air application which I regularly update using the new built-in Air updater (see my post about the Adobe Air update framework) and I want to include the version number in the title of the app.
Now I could do this by hand, but there are two reasons why not:
- I’ts really error prone: if I forget to up the titlebar version number with the app or if the version numbers don’t match users will be confused!
- I’m a programmer! If I can code it, why should I do it by hand?!
Luckily the XML file you use to configure your build (and thus also the version number of the app) is available at runtime as
NativeApplication.nativeApplication.applicationDescriptor
Isn’t that handy? Yes it is! But you know what’s even more handy? The next piece of code that parses the version number from the XML for you!
private function getAppVersion():String {
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXml.namespace();
return String(appXml.ns::version[0]);
//NOTE: in Adobe AIR versions 2.5 and up you should comment the above line and uncomment the line below:
//return String(appXml.ns::versionNumber[0]);
}
Now you’re all set up to use this String in your title bar, about box or wherever you’d like to use it.

Hy, I'm developing a application using Adobe Air but I can't get this piece of code working. I'm using DreamWeaver for coding but it keeps saying that there are syntax errors within this function and when I run the app nothing happens. Could you please help me figure this out? Thanks!
- spam
- offensive
- disagree
- off topic
Like