For the past six months, an increasing number of developers have been commenting, mostly in their blogs, on the capabilities and feature set of Adobe® Flex 2™ software.
Since October 2005, when Macromedia (now Adobe) Labs provided the web developer community with a first look at Flex 2, thousands of developers have downloaded the beta versions of the product and set out to build Flex applications to determine just how extensible and robust this new lineup of developer tools, libraries, and runtime services really is. And the response so far has been overwhelmingly positive not just among enterprise programmers and architects, who were the initial target group of Flex, but also among the Flash developer community, who never quite bought into the powerful yet pricey Flex product line.
With the release of Flex 2, however, things are about to change for Flash "deselopers" (as Adobe's Flash expert Jen deHaan refers to those whose mastery of the Flash IDE distinguishes them as both designers and developers). A revamped, flexible licensing and pricing scheme, coupled with a brand-new, Eclipse-based authoring environment, makes it much easier for the talented community of Flash developers to continue to push the envelope of RIA design and development.
"Flex has always interested us," says R Blank, CTO at interactive media development agency Almer/Blank, "but we didn't really consider switching our main development process at Almer/Blank, because Flex 1/1.5 required a very expensive server component. We couldn't count on any of our clients approving Flex for their projects and we work with large Fortune 500 firms. Now, with the release of Flex 2, Flex is basically an authoring option it's irrelevant to the client if we build a Flash app in Flash Professional or Flex Builder" 2, so we'll start using Flex wherever we feel it adds value, and the client doesn't even need to know."
Flash, Flex, What's the Difference?
Programming in Flex Builder 2 is a lot like programming in Flash Professional. Fundamentally, it enables you to build and deploy SWF files, the compiled bytecode that is interpreted by the virtual machine known as Adobe's Flash Player on desktop browsers. Furthermore, both authoring tools support scripting using the ECMAScript-based ActionScript language albeit the current version of Flash only supports ActionScript 2, whereas Flex 2 supports ActionScript 3, which is compliant with the ECMAScript Edition 4 and opens up a new range of possibilities for web-based building applications.
The key differences between the two authoring tools are threefold: In essence, Flash has been designed to facilitate the creation of interactive content, whereas Flex is geared toward application development. Furthermore, Flash stores your application structure in a binary FLA file, whereas Flex uses a text file based on the markup language of Flex, MXML. Each tool also differs in the development model it employs.
Flex originally was designed to bring enterprise programmers to the Flash Platform. As a result, Flex features tools designed to accommodate the special needs of hard-core programmers. Instead of presentation-related constructs like the Stage, Timeline, and frames, Flex Builder 2 offers a state-of-the-art coding and debugging environment; sports intuitive layout, styling, and interaction tools; and promotes good maintainable coding practices.
Naturally, this environment will be less intimidating to Flash developers who are already familiar with the ins and outs of ActionScript, like Peter Elst of MindStudio: "Flex is significantly easier to learn when you've got a background in ActionScript development. It can help to simply think of the MXML syntax as an abstraction of ActionScript 2.0 classes. Once you're familiar with the basics, things move along rather painlessly, and you'll wonder how you've ever done without."
To get a feel for how easy it really is to get into Flex 2, Elaine Montoya, creative director at Zocoloco Studios, recommends checking out Phil Heinz's excellent online Macromedia Breeze® seminar, Flex 2 for Flash Programmers.
"For months I've wanted to migrate to Flex, but I was concerned that the learning curve would be too steep, and since I have very little time as it is, I've always reverted to using Flash Professional when developing a project. Phil's demonstration made me realize how simple it will be to move to Flex 2. Now I'm hooked."
It's All in the Family
If it's so easy to move to Flex, does that mean the days of Flash authoring are numbered? Not by a long shot. Flash and Flex authoring are complementary not competing approaches to creating immersive user experiences for the Flash Platform.
Working in both Flash and Flex, Flash guru and consultant Aral Balkan compares their strengths with regard to the task at hand: "Flex offers a highly streamlined workflow for creating RIAs. It will not suit everyone's needs, but for Intranet-based RIAs or enterprise RIAs, it is a very serious contender indeed. Among the various similar technologies (like WPF, Laszlo, etc.), Flex has the most elegant programming model I've seen. MXML is a case study in simplicity, compared to the illegible jumble that XAML [the next-generation markup language from Microsoft] can quickly decline into. Flash, on the other hand, is a great tool for building games, consumer-facing websites, web animations, and advertising."
To Flex or Not to Flex
Whether Flex is the right tool for you depends on the task at hand. For example, if you currently use Flash primarily to create animations or highly stylized interactive content, investing in Flex may not be worth your while. However, if a good part of your workload consists of building interactive web apps, Flex will be a great addition to your arsenal of tools. You can even reuse your existing skills and assets, because Flex uses the same runtime environment as Flash, so you can leverage content from your existing Flash apps. You can even migrate your form-based Flash application to Flex in order to extend its capabilities, provided that you have used best practices and pattern-based methodologies and kept your presentation and business logic meticulously separated when crafting your Flash application.
"Once you've successfully separated the presentation and business logic of your applications," explains Balkan, "you can easily port a Flash application to Flex simply by replacing the FLA file with an MXML file and updating any View classes that you want to use Flex-only components on. Since it's all ActionScript, everything else stays the same."
In other words, when migrating a form-based Flash app to Flex, simply re-create your View in Flex, because that's all Flex is a different way of rendering views for Flash-based RIAs. (For more details on what's involved in creating a well-architected Flash application that's easy to migrate to Flex, refer to Balkan's article, Tips for Using Flash Assets in Flex Applications in the February 2005 edition of the Edge newsletter, as well as his self-published tutorial, Migrating a Flash Application to Flex.)
"Flex," argues Blank, "is part of a maturation process of the Flash Platform through which we are seeing a segmentation of Flash development. Over the past ten years, whether you wanted to create a banner ad, a game, or an e-commerce solution in Flash, you had only one option: the Flash authoring tool. Now, with Flex 2, more and more application development will leave Flash. I think you'll see people using a wider variety of tools, specialized in specific areas of the Flash Platform."
And for Blank, the future for Flex looks bright indeed: "We at Almer/Blank are very confident that once Flex 2 and the Flash Player 9 are released, we're going to see a massive spike in the demand for Flex applications as well as for Flex application developers."
Even if you don't see the world through Blank's optimistic eyes, surely you agree that each tool has its place in the Flash ecosystem. You can use Flash Professional to create the most precise, powerful, and expressive interactive content and media. But if you want to be at the forefront of RIA technology and produce complex, robust, large-scale applications that deliver the same level of interactivity and responsiveness as desktop applications, you should take a closer look at Flex 2.
Download Flex 2.0 Beta 3 Release
Visit the Flex Developer Center
Video interview: Ely Greenfield describes the Flex-Ajax
Bridge
Michael Koch is a technical communicator with a penchant for tools and gadgets that make his life easier and more enjoyable.