Conditional includes in ActionScript 3.0

This morning I have looked for a way to include another .as file depending on a variable. ActionScript 3’s include does not allow you to use variables, as it only accepts string literals.

The reasoning for this is that include is fired on compile time, so any variables are not set, determined, or even defined yet.

The Solution

Reading an article, I came across the solution — Config Constants. These are defined in your ActionScript 3.0 settings (File > ActionScript Settings > Config Constants ). Here you can define compile-time constants, and have functionality depend on them.
Continue reading Conditional includes in ActionScript 3.0