flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ent <p...@adobe.com>
Subject Cross-compiling to build components
Date Fri, 06 Dec 2013 16:42:09 GMT
Hi,

I've just finished an experiment with pretty good results.

A little while ago I created a first pass at a FlexJS DataGrid. This meant building both the
ActionScript and the JavaScript components and all of their parts (data model, view, and so
forth). Creating a new component for FlexJS follows the same pattern: build the component
in one language and then build it in the other.

The experiment was to take the ActionScript component and compile it into JavaScript and compare
the result with my hand-crafted JavaScript version. Well, the result was a success. Doing
this uncovered some issues with the FalconJX compiler that were resolved by either Alex Harui
or Erik de Bruin, which I think, strengthened the compiler. Once things were ironed out, the
ActionScript DataGrid compiled cleanly into JavaScript and ran.

This experiment worked for the DataGrid because it is really a composite component. That is,
the DataGrid I created is a Container with a ButtonBar for column headers and Lists for the
columns; the DataGrid co-ordinates the events between all of the lists. This technique would
not work for components that have very custom JavaScript requirements or which have "native"
JavaScript/HTML versions (such a Label or a Button).

What this experiment means is that some components - specifically ones that are composed of
existing components - can be created and tested in ActionScript, then cross-compiled into
JavaScript to provide a fast-path to the JavaScript version. This technique may not work 100%
in all cases, but what it has shown me is that you can get a lot of good code on the JavaScript
side from the ActionScript source, at least enough to quickly finish the JavaScript version.

Regards,
Peter Ent
Adobe Systems

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message