Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The advantages of using higher-level languages should not be news:  it is why Dart and TypeScript and other languages are often used to write JavaScript apps.  What FlexJS also provides is the option to use a declarative language (MXML) as well.  In theory, any JavaScript UI Library could add support for MXML in the future.  But as of this writing, the FlexJS UI libraries are the only ones that support a declarative language and a semi-structure language from a single supplier.How It

For Flex Users

If you have already developed applications using Apache Flex, you are already familiar with the process used to develop applications using Apache FlexJS. That is, you have a mixture of MXML and ActionScript files with some ActionScript embedded in many (if not all) of your MXML files within <fx:Script> tags.

It is not possible (yet anyway) to directly port Apache Flex applications to FlexJS and make use of the ActionScript-to-JavaScript trans-compilation process (see "How it Works", below). Here is a basic outline of what you will need to do to make change your application from Flex to FlexJS:

First, your ActionScript "business logic" can probably remain the same. Those ActionScript files, or many functions within ActionScript files, that do not use any Apache Flex components, might just work. The ActionScript syntax for FlexJS is identical to ActionScript for Flex. Functions, variable declarations, loops, classes, and so forth are unchanged.

Second, your MXML files will need to shift from using Spark and MX components to using FlexJS components. While there are similarly available components, they are not completely identical. For example, FlexJS has the basic components such as Button, Label, and TextInput. But the FlexJS Button is a base class and you will want to use TextButton because it has a label or ImageButton if you want to use an image. TextInput provides just basic keyboard entry; if you want to restrict the input you will need a bead such as PasswordInputBead, to augment the TextInput control's abilities.

FlexJS comes with DataGrid, Panel, Slider, and many other controls as well a Group and Container to help organize and present them. The major difference is that the components only provide basic features and you use beads to add more functionality.

How it Works

FlexJS application development (as opposed to framework component development) is based on the concept of parallel frameworks. The framework components are written in ActionScript with conditional compilation for SWF-specific or JS-specific code.  An ActionScript and MXML compiler code-named "FalconJX" translates MXML and AS to JS and links in JS "classes" instead of AS classes to create the JS output.

...