In fact, MXMLC (a compiler in the Flex SDK) supports some limited preprocessor functions. You can use them to transmit in constant values ββor to simulate functionality like # ifdef / # ifndef.
Check out this documentation.
Example 1:
This code is only -define=CONFIG::debugging,true if the -define=CONFIG::debugging,true flag is passed to the compiler:
CONFIG::debugging {
Example 2:
Change the color of the button depending on whether you have defined "CONFIG :: release" or "CONFIG :: debug"
// compilers/MyButton.as package { import mx.controls.Button; CONFIG::debugging public class MyButton extends Button { public function MyButton() { super(); // Set the label text to blue. setStyle("color", 0x0000FF); } } CONFIG::release public class MyButton extends Button { public function MyButton() { super(); // Set the label text to red. setStyle("color", 0xFF0000); } } }
davr
source share