Accessibility

Flash Article

 

Flex 2: What's in it for Flash developers?


Michael Koch

Michael Koch

Adobe

Created:
10 July 2006
User Level:
Intermediate

Note: This article appeared originally in the Edge newsletter.

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.

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 authoring environment 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 rich Internet application (RIA) design and development (see Figure 1).

Animated DragTile component (shown mid-shuffle) developed by Ely Greenfield using Flex 2.0 Beta 3

Figure 1. Animated DragTile component (shown mid-shuffle) developed by Ely Greenfield using Flex 2.0 Beta 3

According to R Blank, CTO at interactive media development agency Almer/Blank, "Flex has always interested us. 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 Flash Player on desktop browsers. Furthermore, both authoring tools support scripting using the ECMAScript-based ActionScript language—albeit the current version of Flash supports only 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 hardcore 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, who told me: "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, Build RIAs with Flex Builder 2:

"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 told me he 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 applications, 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. 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.

As Balkan explained it, "Once you've successfully separated the presentation and business logic of your applications, 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 recreate 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 (PDF, 493K).

According to Blank, "Flex is part of a maturation process of the Flash Platform through which we are seeing a segmentation of Flash development. Over the past 10 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."

The future for Flex looks bright to him indeed: "We at Almer/Blank are very confident that once Flex 2 and 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."

Where to go from here

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.

About the author

Michael Koch manages the Adobe AIR and Dreamweaver Developer Centers. Prior to joining Adobe, he was principal of MK Publication Services, a Bay Area–based business dedicated to the documentation and marketing collateral needs of businesses and individuals. As a writer and editor, Michael has more than 10 years' wordsmithing and editing experience in the technical sector, with an old-school commitment to clear prose and simple instructions, as well as a sharp eye for everything design related and a passion for gadgets and technologies that enrich our daily experiences.