Each <when>
block which evaluates to true will
include that block of code in the compilation. This provides a mechanism to
conditionally include alternate blocks of code, depending on the value of
compile-time constants.
The supported attributes for <when>
are
<property>
, which looks at a boolean compile
time property: for example <when
property="$as3">
checks for Boolean
true.
<property>
with
<value>
, checks that the given compile time
property equals the given literal value: for example <when
property="$runtime"
value="swf9">
checks for string
equality.
<runtime>
attribute, equivalent to the above: <when
runtime="swf9">
.
The possible compile time constants are:
The following examples show the use of the <with>
, <unless>
, and
<otherwise>
tags.
<canvas
height
="20
" width
="100%
"> <switch
> <when
property
="$dhtml
"> <text
>This program
has been compiled for DHTML
</text
> </when
>
<otherwise
> <text
>This program has been compiled
for SWF
</text
> </otherwise
>
</switch
> </canvas
>
You can also use <unless>
in a similar way.
<canvas
height
="20
" width
="100%
"> <switch
> <unless
property
="$swf10
"> <text
>Not
SWF10
</text
> </unless
> <otherwise
>
<text
>Must be SWF10
</text
>
</otherwise
> </switch
>
</canvas
>
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.