I'm working on an OpenLaszlo application using the unreleased version of OpenLaszlo 5.0 (trunk). In one of my classes I need to import ActionScript 3 classes. What is the recommended way to add such import statements?
Asked
Active
Viewed 132 times
1 Answers
0
LZX supports the passthrough tag. The passthrough tag in turn has a when attribute, where you can specify a boolean expression, e.g. $as3 or $swf10:
<canvas debug="true">
<class name="foo">
<passthrough when="$as3">
import flash.system.Capabilities;
</passthrough>
<handler name="oninit">
if ($as3) {
Debug.info(Capabilities.os);
} else {
Debug.info("flash.system.Capabilities can only be used in the SWFx runtime");
}
</handler>
</class>
<foo />
</canvas>
For the SWFx runtime, the import statement is then injected into the genereated ActionScript 3 class.

raju-bitter
- 8,906
- 4
- 42
- 53
-
Thanks, that's just what I've been looking for. – Aug 09 '12 at 11:01
-
OpenLaszlo supports another syntax using the switch and when tags, but if you use those tags you won't be able to precompile your classes/modules into an LZO library. – raju-bitter Aug 10 '12 at 09:20