O'Reilly logo

Learning Flex 4 by Elijah Robison, Alaric Cole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Why Use Flex?

“Why use Flex?” Did you ask yourself this question when you picked up this book? Flex was created to simplify development of web applications for Flash Player, but it has evolved into a broadly useful framework that lends itself to both web and desktop application development.

Flex Is for Applications

The Flex framework was built to streamline application development, and as such, it includes a number of robust, customizable components that make designing and developing an application relatively easy. Flex programs can run in a web browser or be deployed as AIR applications, so Flex is ideal for writing an application once and delivering it to anyone.

Note

A number of image editing utilities exist as web applications, and you can find several with a quick search. Most of the online editors we found appeared to be built with Flex (they ran in Flash Player), and they had decent user interfaces, but the FXG Editor by 7Jigen Labs stood out as our favorite, not because it had the most graceful UI or the greatest features, but because it provided such a rare, sought-after service—online FXG editing! If you don’t have Adobe Illustrator but want to create FXG graphics, this is the only free option we’ve found.

You can access the FXG Editor by 7Jigen Labs at http://fxgeditor.7jigen.net/.

They also make it available as an AIR application: http://labs.7jigen.net/2010/05/15/fxg-editor-air-app/.

What’s even better? 7Jigen made their source code available. Check it out someday when you’re feeling ambitious: http://www.libspark.org/wiki/seven/fxgeditor/en.

For Easy Interactivity

Flex makes it easy to create a high level of interactivity. It comes with support for data binding, a smooth event architecture, and a set of components with built-in methods for providing user feedback. Add to this the ability to quickly create beautiful effects and transitions, and it’s easy to see why Flex is getting so much attention from new developers.

For Development Speed

There is no faster way to create such rich, interactive, uniquely skinned applications. Although everything you can do in Flex can be done in the Flash IDE, development in Flex reduces the process to a fraction of the time it takes in Flash. And with Flash Builder, development is faster still.

For Speed All Around

Flex components are built in ActionScript 3.0, the latest version of the programming language for Flash Player, and Flash Player 10 was introduced in tandem with the release of Flex 4. Improved performance was one of the goals for Flash Player 10, and it shows. Although you should always make an effort to optimize your programs, you can feel confident that Flex 4 and Flash Player 10 “have your back” when it comes to handling graphically intense routines.

Because It's Clean

Flex supports separation of content and design by allowing external styling of applications. Because of this, you can quickly restyle an application by referencing a fresh stylesheet or by dropping in one of the many freely available Flex themes.

Proponents of the Model-View-Controller (MVC) design pattern will find that Flex supports that architecture as well. Free libraries are available, such as the Cairngorm framework, which simplifies implementing MVC.

Note

For more information on the Cairngorm framework, start at http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm.

While we’re on the subject of Flex frameworks, the Swiz framework is becoming increasingly popular. Its torch-bearers tout its lightweight simplicity, lack of so-called “boilerplate” code, and techniques for creating components to handle repetitive situations. If you can’t tell, we’re describing advanced Flex development, but in the spirit of learning, we recommend that you to look into it someday: http://swizframework.org/.

Because It's Free

Although you have to pay for a full copy of Flash Builder, the Flex framework is completely free. Therefore, you have the option of creating and editing code in your favorite text editor and compiling it using the free command-line compiler without paying a dime.

Note

Only standard components are available to you in the free SDK. Fortunately, most Flex components are standard components. In comparison, advanced components, such as the data visualization (i.e., charting) components, require a Flash Builder license.

The scope of this book is for beginners, and because Flash Builder makes it easy to get started, we’ll discuss development, compiling, and debugging using Flash Builder. Luckily, Adobe offers a free 60-day trial, so there’s no reason not to use Flash Builder while you’re learning Flex: http://www.adobe.com/products/flex.

Because It's Open

Flex is also open source. This means all the component code is yours for the looking (and using and reusing in most cases). As a new developer, having access to the underlying code helps you learn. Open source also means Flex is yours. You can modify and improve the code as well as submit your modifications for inclusion in future versions.

Because it's open source, a community has grown around extending and improving Flex. Scores of freely available advanced components have been created to extend the base set. As such, it’s usually possible to find special components, as well as tutorials explaining how they’re created from scratch.

For Data (and Fast)

Flex offers built-in support for XML and Java objects, simplifying data exchange using these approaches. Flex also supports Action Message Format (AMF). With Java and ColdFusion servers, you can transmit compressed binary data over the wire to your Flex application, making data submission and retrieval much faster than text-based solutions. And for the freeware folks, you can also combine Flex with AMFPHP to send and receive serialized ActionScript objects to and from server-side PHP scripts.

Because It's Beautiful

Although Flex comes with a default theme that may suit your needs, an application’s look and feel is limited only by your imagination. Plus, because styles can be established using Cascading Style Sheets, you can change the look of your program with a single line of code.

Flex provides a robust set of UI controls right out of the box, and with the wide variety of third-party components, you can create any interface you desire. With Flex Charting, you have a nice set of data visualization tools at your disposal. You can choose from bar charts, pie charts, high-low-open-close charts—you name it. Moreover, thanks to the ease of development in Flex, the number of third-party data visualization components is growing every day.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required