Flex3 and the RIA Solution

The heart of what executes a Flex application is the Flash Player


August 21, 2008
URL:http://www.drdobbs.com/web-development/flex3-and-the-ria-solution/210200081

Tariq Ahmed is a software development manager and author of Flex 3 In Action, on which this article is based. Courtesy Manning Publications.


In today's data-centric world, being able to efficiently work with information is a necessity. Users want (and need) access to their "stuff" from whatever computer they're at, whenever they need it. They want to drag and drop, they want rich fluid graphical experiences with sound and video -- and they want it all right now!

Software developers want it all too. Time to market is of high strategic value, software development (and maintenance) is expensive, and guaranteeing that all users are on the exact same version at the exact same time is critical.

Rich Internet Applications (RIAs) address problems such as these by making it possible for developers to give users a compelling experience that, instead of reloading a page every time they click on something, have the feeling of "live" applications. That's the key ingredient to providing users with a sense of engagement.

RIAs do this through browser plug-ins which act as local runtime engines. And with a runtime engine available for various browsers and operating systems, applications look the same no matter what system users are using.

While there are a number of tools that let developers build RIAs, Adobe's Flex, now in its third release, was one of the first. Flex3 is an open-sourced development framework with unique features such as:

The heart of what executes a Flex application is the Flash Player, a powerful, fast, and lightweight platform-agnostic runtime engine. The Flash Player that Flex applications execute on is capable of processing large amounts of data, has robust 2D graphical rendering capabilities, multi-threaded processing, support for various communication protocols, and true multimedia formats, such as streaming video, images, and audio. However, developers coming into Flash from the software world may find the transition awkward at times because of Flash's roots in animation and an environment based on timelines, layers, frames, and frames per second, rather than, say, lines of code.

At the root of Flex is a free SDK which provides a framework for building Flex applications via out-of-the-box libraries and compiler. There's also Flash Builder, an Eclipse-based IDE, and the Flash editor. Flex also leverages two programming languages: The XML-based MXML tag language, and the ActionScript scripting language. When developing in Flex, you use the two together -- MXML to lay out the core of your application (visual components), and ActionScript to script the logic needed to drive your application. New users often struggle when deciding when to use one or the other. A rule of thumb is to pretend MXML is like HTML to visually layout your application, then pretend ActionScript is like JavaScript which adds the brains to your application.

In a nutshell, here's what the lifecycle of a typical Flex application looks like:

If you work with application servers like Coldfusion and PHP, it is important to note that you're not pushing the source files to production, but rather a compiled application (similar to Java's ".java" files).

Flex is an event-driven environment. In traditional Web development, events may mean users clicking on links or Submit buttons, causing your server to execute the appropriate URL and producing some output. However, the term "event" isn't used as much in traditional Web applications because most of the application is on the backend. However, Flex is a client-side technology with all the action on the user's side. Consequently, what drives a Flex application are events — something causes something to occur, and something else handles it when it occurs. Thus the two main pieces of an event-driven application are:

If you're coming from traditional Web technologies, you may not be used to thinking like this.

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.