When developing OpenLaszlo applications, it's sometimes useful to generate the ActionScript 3 source code of an application written in lzx, e.g. when you want to compile OpenLaszlo into an Adobe AIR application.
What is the simplest way to generate the ActionScript 3 source code into a predefined folder?
The
lzccommand line tool which can be found in the$LPS_HOME/WEB-INF/lps/server/bin/has on option for that:By default the OpenLaszlo compiler will generate the ActionScript 3 code into the system specific Java temp folder, but the
$JAVA_OPTSenvironment variable can be used to change that folder.Here's an example of how the command can be used in combination with
$JAVA_OPTSon Linux:a) Create a simple LZX file, e.g.
and save it as
test.lzx.b) Set the
$JAVA_OPTSvariableThe following syntax is for Linux or OS X:
c) Compile the LZX into ActionScript 3
The
tmpfolder will contain the generated ActionScript 3 filesThe folder structure follows the following scheme:
{JAVA_TEMP_FOLDER}/lzswf9/build/{LZX_FILENAME_WITHOUT_ENDING}, therefore in our caseThe main applicaton file is
LzSpriteApplication.as, and you can look into the build.sh file to get an idea how the Flex SDK'smxmlccommand is used to compile the generated source code.