Forgot to make clear, the <when property="foo"> is implicitly testing a boolean value,<br>which many of the compile time constants are. It is just 'runtime' that is a string value, and can be compared via the <when property="foo" value="bar"> form. <br>
<br><div class="gmail_quote">On Wed, Aug 19, 2009 at 6:22 PM, Henry Minsky <span dir="ltr"><<a href="mailto:henry.minsky@gmail.com">henry.minsky@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
There was an older syntax which was specific to the 'runtime' property, and the new syntax<br>can check any compile-time constant property.<br><br>So you can actually say<br><br><when property="runtime" value="swf9"><br>
<br>Which I think would be the best way <br><br>e.g.,<br><br><switch><br> <when property="runtime" value="swf9"><br> <text>runtime is swf9</text><br> </when><br> <when property="runtime" value="swf10"><br>
<text>runtime is swf10</text><br> </when><br> <otherwise><br> <text>some other runtime</text><br> </otherwise><br></switch><br><br>"as3" is more of a language selector than a specific runtime, just as "as2" and "js1" would be. <br>
<br>The compiler sets these constants, which can be checked at compile time<br><br> boolean setRuntime(String runtime) {<br> if (! ("dhtml".equals(runtime) || "j2me".equals(runtime) || "svg".equals(runtime) ||<br>
"swf9".equals(runtime) || "swf10".equals(runtime) ||<br> "swf7".equals(runtime) || "swf8".equals(runtime))) {<br> usage("runtime must be one of swf7, swf8, swf9, swf10, dhtml, j2me, svg");<br>
return false;<br> }<br> compileTimeConstants.put("$runtime", runtime);<br><br> // Kludges until compile-time constants can be expressions<br> compileTimeConstants.put("$swf7", Boolean.valueOf("swf7".equals(runtime)));<br>
compileTimeConstants.put("$swf8", Boolean.valueOf("swf8".equals(runtime)));<br> compileTimeConstants.put(<br> "$as2",<br> Boolean.valueOf("swf7".equals(runtime) || "swf8".equals(runtime) ));<br>
compileTimeConstants.put("$swf9", Boolean.valueOf("swf9".equals(runtime)));<br> compileTimeConstants.put("$swf10", Boolean.valueOf("swf10".equals(runtime)));<br> compileTimeConstants.put("$as3", Boolean.valueOf("swf9".equals(runtime) || "swf10".equals(runtime)));<br>
compileTimeConstants.put("$dhtml", Boolean.valueOf("dhtml".equals(runtime)));<br> compileTimeConstants.put("$j2me", Boolean.valueOf("j2me".equals(runtime)));<br> compileTimeConstants.put("$svg", Boolean.valueOf("svg".equals(runtime)));<br>
compileTimeConstants.put(<br> "$js1",<br> Boolean.valueOf("dhtml".equals(runtime) || "j2me".equals(runtime) || "svg".equals(runtime)));<br><br> compilerOptions.put(Compiler.RUNTIME, runtime);<br>
return true;<div><div></div><div class="h5"><br> }<br><br><br><div class="gmail_quote">On Wed, Aug 19, 2009 at 4:57 PM, Raju Bitter <span dir="ltr"><<a href="mailto:rajubitter@me.com" target="_blank">rajubitter@me.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Henry,<br>
<br>
why is it that you can say:<br>
<br>
<switch><br>
<when runtime="dhtml"><br>
<br>
for testing for DHTML runtime, but for SWF9 you have to say<br>
<br>
<switch><br>
<when property="as3"><br>
<br>
Is there a good reason for not supporting:<br>
<br>
<when runtime="swf9"><br>
<br>
What if we have swf9 and swf10 specific code?<br><font color="#888888">
<br>
- Raju<br>
</font></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>Henry Minsky<br>Software Architect<br><a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a><br>
<br><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Henry Minsky<br>Software Architect<br><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br><br><br>