When you need to additional work on a previously-built OpenLaszlo application, you need to make sure that you use the same version of OpenLaszlo as was originally used to build it. If you use a different version of OpenLaszlo, you may run into incompatibilities in the existing application’s LZX source code. Unless the original application developer documented what version of OpenLaszlo they used, it won’t be immediately obvious.
I’m assuming that at this point, you have the source code, and a compiled SWF (possibly from the live deployment server). If you don’t have the application as a compiled SWF, then this approach won’t work.
First, download and extract Flasm. Flasm is an open-source SWF disassembler. It won’t translate a SWF into LZX code, but it will convert it into readable bytecode, and that is all you really need to find the OpenLaszlo canvas attributes. You run Flasm from the command line.
Second, download the compiled application SWF (the one whose OpenLaszlo version you want to determine) onto your development machine. If its on a production server, you can use a *NIX command-line tool like wget or curl. If you’re on Windows, install Cygwin, and you’ll have all the *NIX goodies you need. (The Windows Flasm executable works well in a Cygwin shell). e.g.
wget http://www.antunkarlovac.com/blog/wp-content/uploads/2008/09/selectionmanager.swf
That should download the SWF to your current directory.
Finally, run Flasm, with the disassemble argument, and search for the term lpsversion. Either save the output to a file, or pipe it through grep. There’s a bunch of output, but I find the last line of output tends to be the relevant one:
…
push ‘canvas’, ‘__LZproxied’, ‘true’, ‘bgcolor’, 16777215, ’embedfonts’, TRUE, ‘fontname’, ‘Verdana,Vera,sans-serif’, ‘fontsize’, 11, ‘fontstyle’, ‘plain’, ‘height’, 260, ‘lpsbuild‘, ‘10323-openlaszlo-branches-4.1‘, ‘lpsbuilddate’, ‘2008-07-11T15:05:43-0700’, ‘lpsrelease’, ‘Production’, ‘lpsversion‘, ‘4.1.1‘, ‘proxied’, FALSE, ‘runtime‘, ‘swf8‘, ‘width’, 300, 14
Note the relevant terms I’ve highlighted in bold:
- lpsbuild: The exact build number of OpenLaszlo that was used to compile this SWF.
- lpsversion: The version number that was used to compile this SWF.
- runtime: The version of SWF that this was compiled to.
There you have it. It’s also a good tip to put a comment in your main application file, to tell other developers (and yourself, six months from now) what version of OpenLaszlo you were using.
You can also use the Charles Debugger which has truly excellent Flash support.
http://www.charlesproxy.com/
If you request the SWF in your browser and watch the log in Charles, you’ll see that the “info” column has the player version for which the SWF was compiled, as well as width/height and frames per second.
*Very* useful when you get a bunch of SWF assets from a designer who accidentally exported them for FP9 when you’re building an application for FP8!
Hey Kathryn,
Thanks for the tip!
I use Fiddler (http://www.fiddlertool.com/fiddler/) for general HTTP traffic debugging, but it doesn’t have any SWF support – you can’t even view the SWF itself in the tool’s interface. It’s pretty neat that Charles does.
Note that the procedure in my post above will only tell you what version of Flash an OpenLaszlo-generated SWF was compiled for. You can probably use Flasm to disassemble a Flash-generated SWF and determine what Flash version it was originally compiled for, but it won’t have the “runtime” attribute; that’s OpenLaszlo specific.
-Antun
This is very good Antun.This help me a lot on my work,thanks for info