views:

1219

answers:

2

Any existing Flash SWF compilers that can understand directives like #IF #ENDIF, etc?

Some SWF Compilers: (Hopefuls)

+2  A: 

I've used mtasc, and it does not support this kind of conditional compilation. However, it looks like Flex 3's mxmlc has support for this via the -define command line option. Also, haXe does exactly what you want.

wulong
Excellent! for the haXe directives docs!
Jenko
+1  A: 

The MXMLC compiler also supports conditional compilation, though it is pretty primitive and strangely-implemented.

They didn't implement 'ifdef'. Instead we just get the value after the comma from the assignment. While this works fine for string insertion, it's pretty confusing for booleans.

The following example would only compile the 'release' implementation of the method:

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

Then in your source code:

CONFIG::debugging
private function configure():void {
 // set up for debugging
}

CONFIG::release
private function configure():void {
 // set up for release
}
Luke Bayes