Flex Conditional Compilation

From Birnam Designs Wiki

Jump to: navigation, search

Flex, when compiled with mxmlc, allows for defining constants in the compile attributes, and to compile blocks of code conditionally based on these variables.

To define, add this to the compile command:

-define=CONFIG::debugging,true

To use this to define a region that is only included when CONFIG::debugging is true:

CONFIG::debugging {
    var msg:String = "in debug mode";
}

or to specify an entire function:

CONFIG::debugging
public function test():void {
    trace("avoid test, in debug mode");
}
Share This!
This page was last modified on 11 February 2010, at 19:36. This page has been accessed 575 times.