Monday, March 22, 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