debuggingapache-flexactionscript

Flex "Debug Only" Code?


Is there a way to mark certain parts of code so that they don't even get compiled in release mode? I know you can do it in C# with syntax like this:

if #DEBUG
    trace("Debug");
else
    trace("Release");

Does Actionscript/Flex have any similar feature?


Solution

  • Yes, you can use:

    CONFIG::debugging { 
        trace("Debug"); 
    }
    CONFIG::release { 
        trace("Release"); 
    }
    

    using the following compiler arguments:

    -define+=CONFIG::debugging,true -define+=CONFIG::release,false
    

    More details is here.