Flash Shared Objects in OpenLaszlo

Flash Shared Objects came up in a discussion today, and I wondered if they would be useful to OpenLaszlo developers. Shared Objects are a Flash feature that work like browser cookies. You create one of these objects to store information across multiple visits to the same application by the same client. e.g. You may want to save the user’s username, so they don’t have to re-type it when visiting the site a second time.

Referencing the SharedObject object is easy. In LZX, when compiling to the Flash runtime, you can call ActionScript objects directly from LZX code. It’s not recommended that LZX developers get into the habit of doing this: it’s not portable to other runtimes, and isn’t supported by Laszlo Systems.

I decided to write a class (lzsharedobject) that encapsulated a single Shared Object, and exposed its value through a “value” attribute. This has a few advantages over sprinkling calls to the ActionScript objects directly:

  • If DHTML-runtime support is needed in future, we have a central place to add some runtime conditionals, and switch to using some other trick (e.g. browser cookies) to handle persisting the saved value.
  • The coding style is declarative. There is a tag called , which makes for cleaner, more expressive code.
  • You get all the nifty OpenLaszlo-y-ness. e.g. You can constrain to the “value” attribute.

Here’s the application in action. Note that the value of the Shared Object will be “undefined” the first time around. Be sure to try reloading the browser:

... and you can download the source code.

OpenLaszlo Webcasts

Ryan Price has a really positive post describing his first glimpse of OpenLaszlo development. I’m glad he likes what he sees, but his post actually alerted me to a webcast by Adam Wolff showing what LZX is like from a developer’s point of view.

Adam was the Chief Software Architect at Laszlo Systems before he left to start his own consultancy, Elastic Process. I guess there’s so much demand these days for OpenLaszlo development that it’s more lucrative to be on your own! Adam is responsible for much much of the Laszlo Foundation Classes – the core classes that are available in all OpenLaszlo applications – and the part of the platform that developers interact with the most.

The webcast is interesting because gives you an end-to-end example of a simple application, including a basic web service, but it’s delivered by the person who wrote the APIs.

If you want to see some more OpenLaszlo Webcasts, check out the Laszlo microsite for the AJAXWorld conference. I’ve already posted about David Temkin’s and my own talks, but there’s a bunch of others (Laszlo had a day-long session). I’ve copied the links below, since they’re easy to miss on the AJAXWorld page:

More developer-oriented:

More strategic/business-oriented:

Whatevr Application and Webcast

The Webcast from my talk at AJAXWorld East is available is now available online. During the talk, I introduce the OpenLaszlo platform, talk about LZX and OpenLaszlo architecture, and finally build an OpenLaszlo application for reviewing restaurants, called Whatevr.

Whatevr application

Just like with David Temkin’s keynote, you have to fill out a form to see the webcast (sorry – out of my control) but you can view the completed Whatevr application online without providing any details whatsoever.