Specifications

159ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
CONFIG::debugging {
// Execute debugging code here.
}
To pass constants, you use the compiler.define compiler option. The constant can be a Boolean, String, or
Number, or an expression that can be evaluated in ActionScript at compile time. This constant is then accessible
within the application source code as a global constant.
To use t he
define option, you define a configuration namespace for the constant, a variable name, and a value
using the following syntax:
-define=namespace::variable_name,value
The configuration namespace can be anything you want. The following example defines the constant debugging
with a value of
true in the CONFIG namespace:
-define=CONFIG::debugging,true
To set the values of multiple constants on the command-line, use the define option more than once; for example:
mxmlc -define=CONFIG::debugging,true -define=CONFIG::release,false MyApp.mxml
To set the value of these constants in the flex-config.xml file, rather than on the command line, you write this as
the following example shows:
<compiler>
<define>
<name>CONFIG::debugging</name>
<value>true</value>
</define>
<define>
<name>CONFIG::release</name>
<value>false</value>
</define>
</compiler>
In a Flex Ant task, you can set constants with a define element, as the following example shows:
<mxmlc ... >
<define name="CONFIG::debugging" value="true"/>
<define name="CONFIG::release" value="false"/>
</mxmlc>
Using inline constants
You can use inline constants in ActionScript. Boolean values can be used to conditionalize top-level definitions of
functions, classes, and variables, in much the same way you would use an
#IFDEF preprocessor command in C or
C++. You cannot use constant Boolean values to conditionalize metadata or
import statements.