Category: Tutorials

Serializing and Deserializing ValueObjects in Flex and AIR

One of the holy grails of the "Build Once, Deploy Anywhere" promise of the Adobe AIR isn’t simply that your application will cross all major operating systems, but also that the same codebase can be deployed via the web as an RIA. Admittedly, there remain some differences in functionality; For instance, a desktop application has to worry about windows or contextual menus. Another challenge altogether is transferring data between a desktop and a web application, which can be a daunting task if you’re trying to share multiple files, yet is perhaps not as difficult as you might think.

Launching Cruise Control during Startup on OSX

I spent a good amount of time today trying to figure out how to turn my “old” iMac into a development environment, which included installing Cruise Control. Since I didn’t want to run the launch script manually, I tried (and failed) to find someone who’s successfully gotten cruise to autostart on boot. A bit of investigation later and I came up with a solution, drawn from an excellent blog post on adding your own osx boot launch scripts, an archive script on launching cruise on unix init, and the tacit information in the MySQLCOM Bootstrapper contained in the OSX Binary Distribution.

Using the Metrics Package to record Flash Application Analytics

Web analytics is a way in which individual visitor action can be easily tracked within a site, and the aggregate statistical data derived from this can often lend remarkable insights into the effectiveness of your design, how ‘sticky’ your content is, and what your users are actually looking for. Unfortunately, extending this paradigm into flash has always been tricky, because it doesn’t adhere to the page-based paradigm on which most Analytics packages are built. Once a flash application or widget is loaded, the server loses most knowledge about what the user is actually doing within it.

Usually this isn’t really a problem- flash applications have not been too complex and not many people care where on the banner you clicked, just that you left the site as a result. Yet now with the strong growth of Flex and Ajax our web applications are becoming more and more complex, and marketers and usability experts are now demanding this tracking data in spite of the paradigm limitations.

If you really think about it, what we really are interested in tracking is a user action, rather than the page loads we are collecting right now, which means that the largest part of an analysts job is turning these page events into meaningful user actions, rather than interpreting those users. There’s been some attempt to set metrics to individual places within a page flow, yet nobody has yet thought to rethink the paradigm. But I digress…

Most Metrics providers have since opened their API’s enough to allow a developer to pretend like a new page refresh has occurred. While this is hardly optimal, it does allow us to track user events from inside of flash, but the fact that each provider has implemented their API a different way means that implementing metrics for each is still a string of unique problems to solve.

To that end I’ve written the Metrics package, which is intended to provide a common metrics proxy that any developer may use, which relies on a common library of connectors that can be swapped out as needed. In this article I go over the details of how to use it, and touch on how individual connectors might be written.

Using ExternalInterface to write Javascript to the HTML DOM

Every Actionscript Developer will sooner or later have to interface with the webpage in which his .swf is presented, and Adobe has provided the ExternalInterface Class to simplify this process. Even so, communicating with an external javascript API almost inevitably requires some number of bridging functions to properly couple the two runtime environments. In cases where the developer has control over both environments this poses no further problems, as for example in an application where the .swf takes animation and event cue’s from an interface written largely in HTML. Some instances nevertheless remain where we don’t have that luxury, and are writing to an external API that we can neither guarantee nor contribute to; In short, we cannot add a javascript file to the HTML wrapper that will act as our translation bridge.