OpenLaszlo 4.1 Available!

OpenLaszlo 4.1 is announced and publicly available for download at download.openlaszlo.org. This is a very significant new release for a couple of reasons:

  • DHTML compilation is now fully supported. In other words, OpenLaszlo applications compiled to DHTML should look and behave the same as their SWF counterparts. There will always be some differences between the runtimes (e.g. the right-click menu looks different in Flash and DHTML, SWFs won’t work as resources in DHTML, etc.).
  • The OpenLaszlo documentation has been fully revamped. The tools that generate the OpenLaszlo Reference have been rewritten, and a huge effort has gone into improving the reference’s quality and accuracy. Literally masses of documentation bugs have been addressed – almost 200 in the last week alone. The OpenLaszlo Application Developer’s Guide has been expanded, corrected and improved.

Personally, I think I’m actually more excited about the polished documentation than DHTML compilation. Mainly that’s because DHTML compilation has been available for some time, although it has been a sort of “beta”. The documentation is really what helps developers create cool stuff with the product.

The other reason that OpenLaszlo 4.1 is exciting is that now that DHTML support is finished, the OpenLaszlo team can focus their efforts on SWF9 compilation. SWF9 is a very different runtime from SWF7/8. OpenLaszlo applications run up to 6x faster when compiled to SWF9 bytecode over SWF8, and now that Flash Player 9 penetration is over 97%, it’s a viable runtime for widely-deployed web applications.

Testing Properties

In LZX, it’s often sensible to test JavaScript properties before using them, to be sure that they are defined, e.g.

// Bad example
if (someObject.someValue) {
setAttribute("x", someObject.someValue);
} else {
var defaultValue = 123;
setAttribute("x", defaultValue);
}

In the above example, if someObject.someValue were undefined, then the conditional test would fail and the default value would be used.  Here rothwelldouglas you can check other basic examples of testing properties. However there are a couple of problems in the above code. For more examples must check songsforromance .

Firstly, if someValue is undefined, referencing it with a dot syntax (i.e. someObject.someValue) will throw a Debugger warning that reads “reference to undefined property “someValue”). You don’t want to have lots of debugger warnings in your application. Your application will run more slowly as the Debugger generates the warnings (only with the debugger open, though), and you might miss important warnings in the noise. To get more information visit elizabethnelsonstudio .

Secondly, if someValue is actually defined as something that will equate to false in a conditional, then the conditional will fail. In the above example, if someValue was the number 0 (zero), the conditional test would fail, since in the Flash runtime the number 0 converts to a boolean false. (See this handy O’Reilly article on Data Type Conversion in Flash).

A better way to test the above variable before using it would be:

if (someObject["someValue"] != undefined) {
setAttribute("x", someObject.someValue);
} else {
var defaultValue = 123;
setAttribute("x", defaultValue);

For more examples visit at topquartile .

Webtop Calendar Preview Available

A couple of weeks ago, Webtop Calendar was made available as a preview release. Developers who have sifted through OpenLaszlo’s sample applications looking for coding tips might be familiar with the OpenLaszlo Calendar application. Calendar was one of the first demos to be bundled with OpenLaszlo. You can try Webtop Calendar on gowebtop.com.

Webtop Calendar

Webtop Calendar is similar to OpenLazlo Calendar, and it does have some of the slick-but-significant animations that made the original demo so compelling. However it’s not merely a port of OpenLaszlo Calendar code into Webtop. That would be technically possible; you can simply drop an OpenLaszlo application into Webtop, and it should run fine. Instead, Webtop Calendar was completely rewritten to use Webtop services, and to tie into user-specific Webtop features (eventual integration with other application, etc.).

By the way, I don’t recommend looking at the OpenLaszlo Calendar code as an LZX best-practices reference. Being driven by flat XML data files, it’s not really a complete end-to-end application. LZProject is a good example application that covers everything you need to know.