the blog
Back to -Blog

Amethyst 2 - Conditional Compilation for ActionScript

Now more like C#
by Dermot Hogan
Friday 12 April 2013.

One of the nice things about C# is that is has good conditional compilation support. ActionScript does support conditional compilation but the syntax isn’t great. In Amethyst 2 we have implemented a C# like syntax for conditional compilation.

Conditional compilation gives you the ability to exclude or include chunks of code at compile time. So in C#, you could say

if (x) {
// do something
} else {
// do something else

This is executed at run time and the code inside the if statement will be run or not depending on whether x is true.

But you can also do this

#if X
// do something
// do something else

Here, the ‘do something’ code will only be compiled if the X symbol is defined. Otherwise the ‘do something else’ code will be compiled in. In other words, it’s done at compile time not run time.

ActionScript does allow conditional compilation, but the syntax is peculiar to say the least. For example,

CONFIG::debugging {
// debugging code here.

and you define the constant in the compiler’s arguments like this


In Amethyst 2, we’ve implemented a scheme similar to C#, but using just #if, #else and #endif and with no arithmetic – just ’is the symbol defined’ or not.

The text not included is greyed out in the Editor:

You set the symbols to be ‘defined’ in the compilation options

Note that the options are configuration dependent, so that you can have code included or excluded for, say, Release or Debug configurations.

Clearly, the #if, etc., syntax isn’t ActionScript and so if you export it to another IDE or use just the basic Adobe compilers you will have problems. However, even allowing for that we still think that it’s much nicer to have the #if syntax rather than something like //#if - and that’s what we’ve used.

This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2
© SapphireSteel Software 2013
more info about nexium otc clarinex 5mg medicine in mexico arimidex eye twitch differin with benzoyl info about prostate ditropan bactrim for boils abilify pharmaceutical crestor cannot sleep famvir hearing quinine pills exelon nuclear plants zyrtec d cost in california amoxicillin suspension uroxatral bph melatonin add adhd toradol nih combivent 200 lipitor bowel movements detrol la commercial lovastatin sgpt in california tricor benicor information gymna sylvestre glucophage zoloft tab ovarian cysts clomid compare price propecia aldosterone melatonin in new york lexapro prescription medicine coumadin programs synthroid dental concerns coumadin guidelines elderly zoloft in uk information about nexium home page actonel candidiasis connection in california welbutrin xl inderal crestor rectal in india plavix flexiril generic for maxalt paxil snorting nolvadex for men zocor shelf life nms from geodon actos nursing prilosec plavix famatidine about cipro bayer 0500 msds sheets chloramphenicol sinemet biosciences allegra hinson reglan experiences lipitor equivalent prilosec rick prometrium after insemination aleve comercial actress seroquel suicidal thoughts walmart depakote tegretol tremors kajal