Here we want to display Flex Project's version number in an "About Us" screen's label.
I want to retrieve the build number and last compiled time stamp dynamically.
I have surfed in net and found in many examples that use ruby or bat coding to do the process of updating a version number and retrieving. Is there any way to update and maintain the version number dynamically(each time I start the debugger) using actionscript alone (with out using any other language's coding).
kindly help me. Thanks a lot in advance.
You can read your App's descriptor at run-time (for example to get the app's version number) like this:
private function getAppVersion():String {
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXml.namespace();
var appVersion:String = appXml.ns::versionNumber[0];
return appVersion;
}
This blog mantions it: http://inflagrantedelicto.memoryspiral.com/2009/02/quick-tip-display-application-version-in-your-air-app/
The Flex version number is available, but it's namespaced. You'll have to use the namespace mx_internal
to be able to access it. Like this:
import mx.core.mx_internal;
use namespace mx_internal;
versionLabel.text = VERSION;
Usually you should treat everything Adobe has namespaced 'mx_internal' with care, because they don't guarantee that anything in there will remain the same in future versions of Flex. So you might run into backwards compatibility issues when upgrading your Flex SDK. It seems rather unlikely they would make changes to the VERSION constant though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With