Just a quick tip for those looking to somehow display the AIR application version from the descriptor file. I’ve found it very helpful in troubleshooting is users can say EXACTLY what version of the app they are running.
AIR 2.5 and later:
private function getAppVersion():String { var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor; var ns:Namespace = appXml.namespace(); var appVersion:String = appXml.ns::versionNumber[0]; return appVersion; }
Older versions of AIR:
private function getAppVersion():String { var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor; var ns:Namespace = appXml.namespace(); var appVersion:String = appXml.ns::version[0]; return appVersion; }
Pingback: In Flagrante Delicto! ยป Quick Tip: Display Application Version in … - edvdbox
Awesome. Thanks for the great tip.
Thank you! Very helpful!
Exactly what I was looking for. Thanks!
Pingback: Raymond Camden's ColdFusion Blog: Determining the version of an …
Looks like in AIR >= 2.5 the version property is defined as ‘versionNumber’, not the older ‘version’.
This is correct.
Your code is black text on black background. Not the best combination :)
Yikes! Thanks for pointing that out. It was using an older syntax highlighter – should be fixed now.
Thanks , really helped saving time writing it in manually.
Thanks. Saved me precious time!
Sadly it’s not working on Flex 4.6 AIR 3.3. And it took me more than an hour and I can’t find the solution yet.
AIR 2.5 and greater requires :
var appVersion:String = appXml.ns::versionNumber[0];
I’ve updated the post to reflect this change.
work Flex 4.6 Air 3.3
protected function init():void
{
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXml.namespace();
var appVersion:String = appXml.ns::versionNumber[0];
trace(appVersion);
}
THANK YOU VERY MUCH !!!!
Thanks,
Exactly what I needed!
I have shared it no stackoverflow to spread the word:
http://stackoverflow.com/a/13858284/1680826