What is Flex?

I belong to a number of programming mailing lists, and occasionally I see people ask about Flex, and I figured I’d give my two cents worth of what I understand Flex to be. Recently on the Direct-L mailing list, a list for Adobe Director developers, this topic came up. Here’s the reply I gave to this question:

Hi,

As a Flex developer, I thought I’d interject here and add to the discussion. I realize some people may have already covered these points, but I figured I’d explain it how I understand it.

There are a number of terms to understand when talking about Flex:

Actionscript 3
Flex SDK
Flex Builder 3
MXML
AIR

Actionscript 3 –> The latest programming language for interacting with the Flash Player. Flash CS3/CS4 create swfs that play in the Flash Player. The current Player can run swfs created in AS3 and is backwards compatible with Actionscript 2, and 1. As we know, Director can interact with AS 1, 2, and a limited set of AS 3 swfs.

Flex SDK –> http://opensource.adobe.com. The SDK includes command-line compilers to create swfs (currently running in Flash Player 9 or 10) and AIR files (that run on the desktop). This is free and opensource, and you can use any text editor to write your code. Flex includes a number of components – pre-built controls/layouts/interfaces to allow for fast prototyping of Rich Internet Applications or RIA’s. Flex is a framework. A set of classes that extend the current implementation of Actionscript 3. This additional set of classes is not currently supported in Director.

Flex Builder 3 –> http://www.adobe.com/flex. An Eclipse based IDE from Adobe that gives you a GUI for creating Flex applications that run on the web (swf) or desktop (AIR). This is a commercial product. It uses the Flex SDK to compile the code, and includes a powerful script editor, debugger, and additional memory profiling tools. Comes in two flavors, Standard and Pro.

MXML –> Markup language for use in creating Flex apps. It is a way to quickly layout visual elements using code. MXML is compiled down to Actionscript 3, which is compiled into the swf.

AIR –> http://www.adobe.com/air. Adobe Integrated Runtime. Think of it as a Flash Player for the desktop. It’s a separate download that is installed on the users machine, that can install and run .air files. Once the AIR runtime is installed, you can then install .air files to the users machines. These install just like any other desktop app, including a desktop shortcut, Dock/Taskbar icon, and the ability to uninstall using the OS’s uninstall mechanism. It runs on Linux, Windows, and Mac. In addition to the Flash Player functionality, you get additional API’s that allow you to interact with the users machine. This includes a built-in SQL database and an HTML renderer (WebKit). Flash CS3/CS4 and Flex both have the ability to generate .air files that play in the AIR runtime. In addition to Flash and Flex, you can create AIR apps with just HTML/Javascript. There is a plugin for Dreamweaver to create AIR apps, or you can use any text editor, along with the AIR SDK. So to clarify – YOU DON”T NEED TO USE FLEX OR FLASH to create AIR apps. You can do it with just HTML/Javascript/AJAX if you want. =D

Why Flex, why not just Flash? Flex is for developers. You don’t have a timeline to create animations with. You typically see it used in enterprise level apps. Since it uses Actionscript 3, you can easily integrate Flash produced animations, etc. They are two different tools that provide different approaches to creating content for the Flash Player, and AIR. I use both when creating my applications. I use Flash to create the skins/animations and Flex to create the interactions.

There is so much more to it than what I’ve explained, but hopefully you have a better sense of how they relate to each other. I do have a website where I cover a lot of Flash/Flex stuff –> http://www.tutorialsbyibrent.com

Regards,

iBrent