The following example shows how you can determine your Flex SDK version within a Flex application by using the internal mx_internal::VERSION property.
You can also find the version number by doing one of the following:
(a) Viewing the flex-sdk-description.xml file in your Flex SDK’s root directory:
<?xml version="1.0"?>
<flex-sdk-description>
<name>Flex 4.0</name>
<version>4.0.0</version>
<build>3934</build>
</flex-sdk-description>
(b) At a command prompt, navigate to your Flex SDK’s /bin/ directory and type mxmlc -version:
C:\dev\flexSDKs\4.0.0.3934\bin>mxmlc -version Version 4.0.0 build 3934
Full code after the jump.
Since this example uses the mx_internal namespace, you can’t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/ -->
<mx:Application name="mx_internal_VERSION_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Label text="{mx_internal::VERSION}" />
</mx:Application>
View source is enabled in the following example.
Due to popular demand, here is the “same” example in a more ActionScript friendly format:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/ -->
<mx:Application name="mx_internal_VERSION_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
initialize="init();">
<mx:Script>
<![CDATA[
import mx.controls.Label;
private var lbl:Label;
private function init():void {
lbl = new Label();
lbl.text = mx_internal::VERSION;
addChild(lbl);
}
]]>
</mx:Script>
</mx:Application>
Or, you can use data binding (and not get a warning) by using the use namespace, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/ -->
<mx:Application name="mx_internal_VERSION_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
use namespace mx_internal;
]]>
</mx:Script>
<mx:Label text="{VERSION}" />
</mx:Application>



Just updated my About Box to show this info. However, the mx_internal::VERSION says that I’m using 3.0.0.0 whereas FlexBuilder is compiling to Flex 3.1.
How is this possible?
Mark,
We may not have updated the
VERSIONproperty in 3.1.0.x. Like I say, its anmx_internalproperty, and it’s one of those “use at your own risk” things. ;)Peter
You can also use FlexVersion.compatibilityVersionString. However, I don’t think they can update the version number without breaking code. Throughout the SDK I see code peppered like this:
if (FlexVersion.compatibilityVersion