|
ConditionalCompilation
Conditional compilation options explained.
IntroductionEven if we try to make our AS3 code as portable as possible we have to deal with different little nuggets
UsageAll conditional compilation options deal mainly with hosts and API differences DO NOT USE THEM for dynamic configuration, eg. it will not replace the namespaces standard, optimized and experimental. from the doc You can use inline constants in ActionScript. Boolean values can be used to conditionalize top-level definitions of functions, classes, and variables, in much the same way you would use an #IFDEF preprocessor command in C or C++. You cannot use constant Boolean values to conditionalize metadata or import statements. for Flex Builder 1. Project properties 2. ActionScript Compiler 3. in Additional compiler arguments -define+=TAMARIN::exclude,true -define+=TAMARIN::alternate,false for mxmlc, compc <compc
output="foobar.swc"
include-classes="foobar.as"
target-player="9.0.45"
>
<define name="TAMARIN::exclude" value="true" />
<define name="TAMARIN::alternate" value="false" />
<strict>true</strict>
<optimize>true</optimize>
for ASDoc <exec executable="${asdoc.exe}">
<arg line="-define+=TAMARIN::exclude,true" />
<arg line="-define+=TAMARIN::alternate,false" />for ASC <exec executable="java">
<arg line="-jar ${redshell.asc}" />
<arg line="-AS3 -strict -md -optimize" />
<arg line="-config TAMARIN::exclude=false -config TAMARIN::alternate=true" />OptionsTAMARIN::excludeExcludes block of code when compiling for Tamarin/redtamarin some examples: /* reason:
no TextField support in Tamarin
*/
TAMARIN::exclude
{
suite.addTestSuite( TextFieldTargetTest );
}TAMARIN::alternateAllows to provide an alternative for Tamarin/redtamarin only. TAMARIN::alternate will be replaced by API::RT_0_2_5 etc. API versioningBased on API Versioning in AVM from the Tamarin project, we will use the same naming convention.
Technically we will almost never use API::FP_9_0 as this our default minimum version of the API (unless we have to isolate some code for tamarin), but as we want also to support command-line AS3 (via redtamarin) we need specialized API for that
We will mainly support redtamarin API but not Tamarin itself. Contrary to the FP and RT API where each version is a subset of itself and zero or more other versions, the RT API works differently and can be totally incompatible and for those cases we will uses TAMARIN::exclude. ProposalsThese conditionals are not used yet
|
Sign in to add a comment