Specifications

287ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
When you set the compatibility-version option, you must be sure that the configuration files that you use are
compatible with the version you select. For example, the way that locales and metadata elements are set up in the
flex-config.xml file is different between Flex 2.0.1 and Flex 3. For a complete list of differences, see “Differences
between SDK 2.0.1 and SDK 3” on page 287.
You can programmatically access the version of the Flex application that you are running by using the
mx.core.FlexVersion class. To get the current compatibility version in your application, use the
compatibilityVersionString property of that class. This lets you conditionalize the logic in your application
based on the compatibility version.
Using themes
When you set the compatibility version, you should also be sure to use the appropriate theme file that matches
that version. For Flex 2.0.0 and 2.0.1, you should use the HaloClassic.swc theme file. Themes are located in the
frameworks/themes directory. For Flex 3, you do not have to specify a theme file. The default theme file is
designed for Flex 3 compatibility. For more information on using themes, see “About themes” on page 645 in the
Adobe Flex 3 Developer Guide.
The default style sheets for several versions of Flex are available in the framework.swc file. This SWC file contains
the current default style sheet (defaults.css), the Flex 2.0.1 default style sheet (defaults-2.0.1.css), and the Flex 2
default style sheet (defaults-2.0.0.css). The compiler uses the style sheet that is appropriate for the compatibility
version you set. For example, if you set the
compatibility-version option to 2.0.1, then the compiler uses the
Flex 2.0.1 default style sheet.
Differences between SDK 2.0.1 and SDK 3
The differences between SDK 2.0.1 and SDK 3 that result from setting the compatibility-version option are
mostly style properties and the styles applied to subcomponents.
Subcomponents are components within other components that inherited the styles of their parent in SDK 2.0.1
but do not in SDK 3. For example, the DateField control has a DateChooser subcomponent. In Flex 2.0.1, if you
set noninheritable style properties such as
borderColor or cornerRadius on the DateField control, the styles
are also applied to the DateChooser subcomponent. This resulted in unexpected styling of the subcomponent and
it was difficult to override this behavior. In Flex 3, these styles are not passed through from the DateField control
to the DateChooser subcomponent, but you can choose to pass them through.
The following application shows the difference between how a DateField control appeared in SDK 2.0.1 and how
it appears in SDK 3:
<?xml version="1.0" encoding="utf-8"?>
<!-- versioning/DateFieldSubComponentStyles.mxml -->
<!-- Compile this sample twice: once with the compatibility-version