Take the 2-minute tour ×

When developing OpenLaszlo applications, it's sometimes useful to generate the ActionScript 3 source code of an application written in , 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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The lzc command line tool which can be found in the $LPS_HOME/WEB-INF/lps/server/bin/ has on option for that:

  for as3 runtime, emit intermediate as files, 
  but don't call backend as3 compiler

By default the OpenLaszlo compiler will generate the ActionScript 3 code into the system specific Java temp folder, but the $JAVA_OPTS environment variable can be used to change that folder.

Here's an example of how the command can be used in combination with $JAVA_OPTS on Linux:

a) Create a simple LZX file, e.g.

  <button text="Hello world" />  

and save it as test.lzx.

b) Set the $JAVA_OPTS variable
The following syntax is for Linux or OS X:

export JAVA_OPTS="-Djava.io.tmpdir=./tmp -DXmx1024M"

c) Compile the LZX into ActionScript 3

> lzc --lzxonly test.lzx --runtime=swf10
Compiling: test.lzx to test.swf10.swf

The tmp folder will contain the generated ActionScript 3 files

├── lzccache
└── lzswf9
    └── build
        └── test
            ├── app.swf
            ├── build.sh
            ├── LzApplication.as
            ├── $lzc$class_basebutton.as
            ├── $lzc$class_basecomponent.as
            ├── $lzc$class_basefocusview.as
            ├── $lzc$class_button.as
            ├── $lzc$class__componentmanager.as
            ├── $lzc$class_focusoverlay.as
            ├── $lzc$class__m2u.as
            ├── $lzc$class__m2v.as
            ├── $lzc$class__m2w.as
            ├── $lzc$class__m2x.as
            ├── $lzc$class__m2y.as
            ├── $lzc$class__m2z.as
            ├── $lzc$class__m30.as
            ├── $lzc$class__m31.as
            ├── $lzc$class__mm.as
            ├── $lzc$class__mn.as
            ├── $lzc$class__mo.as
            ├── $lzc$class__mp.as
            ├── $lzc$class_statictext.as
            ├── $lzc$class_style.as
            ├── $lzc$class_swatchview.as
            ├── LZC_COMPILER_OPTIONS
            ├── LzPreloader.as
            └── LzSpriteApplication.as

The folder structure follows the following scheme:

{JAVA_TEMP_FOLDER}/lzswf9/build/{LZX_FILENAME_WITHOUT_ENDING}, therefore in our case


The main applicaton file is LzSpriteApplication.as, and you can look into the build.sh file to get an idea how the Flex SDK's mxmlc command is used to compile the generated source code.

share|improve this answer

Your Answer


