You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

FlexJS Frequently Asked Questions (FAQ)

What is FlexJS?

FlexJS is the next-generation Flex SDK that that has the goal of allowing applications developed in MXML and ActionScript to not only run in the Flash/AIR runtimes, but also to run natively in the browser without Flash, on mobile devices as a PhoneGap/Cordova application, and in embedded JS environments such as Chromium Embedded Framework used in the Adobe Common Extensibility Platform . FlexJS has the potential to allow your MXML and ActionScript code to run in even more places than Flash currently does.

Is FlexJS Backward Compatible With the Flex SDK?

The FlexJS framework will not be 100% compatible with the current Flex SDK. Many implementation decisions will be decided by what will result in optimal JS output as well as what can be implemented in the short term in JS.

However, the goal is definitely to try to utilize as much existing MXML and ActionScript in existing applications as possible, and leverage the knowledge base and skill sets of experienced Flex developers and even leverage the tools such as Adobe Flash Builder. If you have an application consisting of 10,000 lines of MXML and 100,000 lines of ActionScript, instead of having to rewrite each and every line directly to JS or to some other JS framework, you should be able to use FlexJS and rewrite significantly fewer lines to get this code to run without Flash. FlexJS will support "states", databinding, and CSS just like the current Flex SDK (with some limitations).

How much work will it be to switch from Flex to FlexJS?

A quick assessment of the how much work it will be to switch to FlexJS can be done by searching existing code for "import flash". Files that import classes from Flash packages are generally using APIs that will not be in early versions of FlexJS. Note that importing flash classes in MXML files is not required so finding use of low-level Flash APIs in MXML files is not practical. Some Flash classes are events which may be supported by FlexJS.

One way to think about the migration to FlexJS is to ask whether you would have had to rewrite it anyway. For example, the FlexJS compiler does not support E4X expressions. JS has no E4X equivalent, so you would have had to re-code E4X expressions whether you switched to FlexJS or some other JS framework. If possible switching to JSON is recommended as it is supported in both AS and JS.

What level of Browser support is required?

The plan is to support IE8 and later, and relatively recent versions of FireFox and Chrome and probably even Safari. Thus an HTML5-capable browser is not a requirement to use FlexJS. There may be different versions of the JS components that are HTML5-dependent that provide faster or smaller output if you can require HTML5 browsers for your target customers.

Can we target use JS Frameworks like JQuery or Dojo?

There can be more than one JS version of a FlexJS component. There is already a prototype of a JS version of an Application class that includes the startup code for a JQuery app and then the Button component wraps the JQuery Button. Thus it is possible to use MXML and AS to construct a JQuery application.

What about performance?

One unanswered concern at this time is about performance of the JS output. We won't know for sure until we get enough infrastructure working to run a large app, but the goal is for the JS framework to be as low overhead as possible. If you were to migrate your app to JS either directly or via some other JS framework, you would most likely use some sort of object-oriented concepts in this app. When creating components for FlexJS we look at what those constructs might be and then translate them to AS classes thus keeping overhead lower than writing code that leverages Flash and then trying to translate it to JS. Thus, if there is a performance problem with the FlexJS output, it would likely have been the case even if you had used some other JS framework.

Can I use FlexJS to convert my Flex code to HTML/JS/CSS?

It is probably possible to create a tool that translates your MXML to HTML in some way so that you can run your application through the compiler, get HTML and JS and never go back to MXML and AS again. There will likely be some way to dump out the HTML from the app at runtime. But many UIs are too dynamic to be easily represented in HTML. Thus the goal of FlexJS is to provide for the use of MXML and ActionScript as the ongoing development language.

Why also output to SWF?

There is an advantage to using a more strict language like ActionScript in your development and why Flex was so successful at developing enterprise-grade applications. There are fewer ways to make small but highly-impactful mistakes in AS. Hopefully your large applications are written with some level of modularity. The language and compiler force you to be more careful at the integration points between those modules. And while some JS frameworks can do much of that as well, the fact that you can produce a version of your application that runs as a SWF in Flash gives you one more level of checking because the Flash ActionScript VM will perform runtime checking of your code. This is especially important in highly dynamic applications where modules are loaded on the fly and may be provided by third parties. There is not always a practical way to compile-time check that the integration points are fulfilling the contracts in other JS frameworks if you don't have all of the code in one place.

Also, if you can use Flash in the browser, you will likely save on the cost of testing your application in those browsers. You may also choose to use the Flash version in older browser so you can use an HTML5-dependent component set in other browsers.

Won't it take several years before FlexJS is ready?

The current Flex SDK represents many years of development. There is no way a volunteer-based effort can quickly reproduce a next-generation of all of that code. Not all of it will be re-created in FlexJS as some APIs, especially XML/E4X APIs, will probably not translate well to JS. But under the hood, the new framework is designed to leverage incremental development. The most common APIs of the most popular UI controls will be developed first, then additional functionality will be added over time. How soon that happens depends on how many people get involved and contribute.

How can I get involved?

Participation in any form is encouraged and welcomed. To follow the development of FlexJS, please subscribe to the Apache Flex mailing list dev@flex.apache.org. This is a high traffic list that covers development of the current Flex SDK as well, but we try to mark all FlexJS discussion with the subject "FlexJS".

  • No labels