Friday, March 26, 2010

Conditional ActionScript Compiling

Is it possible to do conditional ActionScript compiling in Flash Builder 4? This is one of Flash CS4's better features.

In Flash Builder 4 it would be cool if we were able to do something like this:

CONFIG::IS_AIR_PROJECT {

?// air-specific code here

}

CONFIG::IS_ACTION_SCRIPT_PROJECT {

?// browser-specific code here

}

CONFIG::IS_DEBUG_BUILD {

?// debug-pecific code here

}

COFING::IS_RELEASE_BUILD {

?// release-specific code here

}

... and so on.

Conditional ActionScript Compiling

Works just fine.

Just add -define=CONFIG::XYZ,true


..to your additional compiler args for your Flash Builder project.

-C

Conditional ActionScript Compiling

Fantastic, thank you.

Would be even better if we could add compiler constants into the actual code of a project rather than having to put them into the compiler args

Is set up all those conditional constants in a top include file into the main project, or even have a compiler arg that loads a file full of condition deffs

I just find it clumsy to have to add them to the compiler arg in prefs.

Its fine when using ant or something as adding to the arguments is simpler just because youre not stuck with that single line text input on the prefs.

At least change the compiler args input to a text area not a text input

Glenn,

Feel free to log a bug with your requests here. ?Its more likely to get considered for the future if its in a bug.

Thanks!

Joan

Glenn,

This seems to work (possibly undocumented Kung Fu provided by Peter Donovan from the compiler team):

package
{
?config namespace FOOBAR;
?FOOBAR const one = false;
?FOOBAR const two = true;
?
?public dynamic class MyClass
?{
?public function MyClass()
?{
?super();
?}
?
?FOOBAR::one
?public function abc():void
?{
?trace(''one'');
?}
?
?FOOBAR::two
?public function abc():void
?{
?trace(''two'');
?}
?
?}
}

No comments:

Post a Comment