davidkomer
davidkomer

Reputation: 3078

Optional compile in Flash Builder

Is there a way to tell Flash Builder 4.7 to optionally compile certain lines?

I.e. right now lets say an app has lines like:

if(DEBUGMODE) {
trace("foo");
}

Instead of it not displaying, I want it to not even compile that trace line (as bytecode) into the SWF/AIR/etc., and to toggle that across the whole app given certain directives.

Upvotes: 0

Views: 60

Answers (1)

Marcela
Marcela

Reputation: 3728

You are looking for conditional compiling, this link should help you: http://www.flexer.info/2010/03/04/how-to-create-conditional-compilation-definitions-conditional-compile-blocks/

Basically, you'll want to add -define+=CONFIG::development,true to your compiler options

Then, in your code, you'll create a conditional block like so:

CONFIG::development {
    // this is a conditional compile block
    // it will only compile if CONFIG::development is set to true in your options
}

Upvotes: 3

Related Questions