The OpenLaszlo debugger is a very versatile tool. You can use it for everything from tracing output, to analyzing the state of objects within your application at runtime, to tracking-down memory leaks. The debugger requires the OpenLaszlo server to be present, but works with SOLO applications – provided the SOLO application can access server. Naturally, while developing a SOLO OpenLaszlo application, you want to have the full capabilities of the debugger available to you.
To achieve this your development workflow should involve:
- Make sure the debugger is enabled in the canvas (debug=”true”).
- Change your LZX source file(s).
- Recompile by accessing the application in your browser (i.e. http://localhost:8080/lps-version/…/my-app.lzx).
- Use the debugger.
The above will work fine for both SOLO and proxied OpenLaszlo applications, since you’re accessing the LZX directly. What happens when you want to have a custom HTML wrapper page? You may have to access your OpenLaszlo application via a wrapper page if, say, you pass parameters from the wrapper page to your own application. In a SOLO application, your SWF will probably be embedded in a custom wrapper page like the following. (This is the new 4.1 embed code, the embed code for 4.0.12 looks a little different):
lz.embed.swf({url: 'main.lzx.lzr=swf8.swf?myparam=123', bgcolor: '#ffffff', width: '800', height: '600', id: 'lzapp', accessible: 'false'});
As an example, I’ve added a myparam paramaNote the direct reference to the compiled SWF file. If you run the above application with the debugger open, it will throw the following error:
Debugger cannot contact LPS server, switching to SOLO mode.
At this point, the debugger can trace output from Debug.write() statements in your code, but it won’t be able to execute arbitrary code you type into it, or many of its other useful features. To fix this, when developing SOLO applications within a custom wraper page, you should embed the application as follows:
lz.embed.swf({url: 'main.lzx?lzt=swf&lzr=swf8&myparam=123', bgcolor: '#ffffff', width: '800', height: '600', id: 'lzapp', accessible: 'false'});
Since you specify that the application is SOLO in your LZX code, the returned SWF will be a SOLO OpenLaszlo application, but it will have access to the server too. I wouldn’t recommend using the command-line compiler for development.