This is working fine for me:
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXml.namespace();
var appVersion:String = appXml.ns::versionNumber[0].toString();
trace("appVersion", appVersion);
----------------------------------------
> Date: Sun, 5 Jul 2015 02:34:35 +0000
> From: [email protected]
> To: [email protected]
> Subject: Re: problem getting current version number using
> ApplicationUpdaterUI()
>
> Is there any reason why the following code would return different values
> running in Flash Builder debugger compared to when installed as an
> application on the computer?
>
>
>
> var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
>
> var ns:Namespace = appXML. namespace ();
>
> The debugger sees the right version number, but the installed app looks like
> (I'm guessing) it's getting some default, initialized, value (?)
>
> ----- Original Message -----
>
> From: [email protected]
> To: "apache users" <[email protected]>
> Sent: Saturday, July 4, 2015 7:06:04 PM
> Subject: problem getting current version number using ApplicationUpdaterUI()
>
> I'm struggling to get ApplicationUpdaterUI() working with Flex 4.12 using
> Flash Builder 4.7 and Air 3.1.
>
> I'm getting a Download Failed error (e.g. There was an error downloading the
> update. Error# 16824) when the updater attempts to download the new version.
>
> I'm trying to follow the directions here:
>
> http://www.adobe.com/devnet/air/articles/air_update_framework.html
>
> as well as here:
>
> http://help.adobe.com/en_US/air/build/WS96E10DFB-39A5-4488-A666-15B9B46C5EE8.html
>
>
> My code is at the bottom of this post.
>
> One interesting issue I see is that the label text in lblAppVersion.text
> always reports version 0.0.0. Note that I did update the xml code on the
> server to use "versionNumber" instead of "version", as well as the AS3 code
> here:
>
> lblAppVersion.text = "App version: " + appXML.ns::versionNumber;
>
> but the current version shown in the app as well as the updater UI window
> displays 0.0.0 instead of, say, 1 or 2 etc. (I've tried so many times).
>
> Interestingly, when I run the app in the FB debugger the version number is
> correct; it's only when I download the app from the internet and install it
> on my Mac, then run it, does it always show 0.0.0.
>
> Anyone know what could be causing this (I'm hoping that resolves my error
> above)?
>
> My code...
>
> private var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI();
>
> private function checkUpdate():void {
> setApplicationVersion();
> appUpdater.updateURL = "https://www.example.com/aa/update.xml";
> appUpdater.delay=1;
> appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);
> appUpdater.addEventListener(ErrorEvent.ERROR, onError);
> appUpdater.isCheckForUpdateVisible = false;
> appUpdater.isFileUpdateVisible = false;
> appUpdater.isInstallUpdateVisible = false;
> appUpdater.initialize();
> }
>
> private function onUpdate(event:UpdateEvent):void {
> appUpdater.checkNow();
> }
>
> private function onError(event:ErrorEvent):void {
> Alert.show(event.toString());
> }
>
>
> private function setApplicationVersion(): void {
> var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
> var ns:Namespace = appXML. namespace ();
> lblAppVersion.text = "App version: " + appXML.ns::versionNumber;
> }
>
> And the update.xml file:
>
> <?xml version="1.0" encoding="utf-8"?>
> <update xmlns="http://ns.adobe.com/air/framework/update/description/2.5">
> <versionNumber>10</versionNumber>
> <url>https://www.example.com/aa/myapp.air</url>
> <description><![CDATA[
> This version has fixes for the following known issues:
> *First issue
> *Second issue
> ]]></description>
> </update>
>
> And I also make sure that my app-app.xml contains the same version number as
> the update.xml file, before I export the release build and move it and the
> update.xml files to the server.
>
>
>