There was a question posted on the Flash Coders group on LinkedIn.com last night asking the simple question: “What is Flex?”
I think reading about Flex for the first time can be a little confusing and intimidating, so here are some points to keep in mind:
- If you are coming from the Flash world, you can think of Flex as building Flash applications using a set of pre-built components (think of what appears under the Components panel in the Flash authoring tool’s Window menu).
- Flex actually refers to a set of technologies, most notably what is known as the “Flex Framework,” a library of reusable components for rapidly creating Rich Internet Applications (RIAs) — that is applications on the web that behave like desktop computer applications. The components that make up the library are ActionScript class files (read up on Object-Oriented Programming if that is meaningless) that may be instantiated (created) using MXML or ActionScript. Interactivity between the components is generally provided by ActionScript, whether or not the application was built using MXML or not. All Flex Framework components reside under the “mx” package in the Flex API reference (which is a list of all the ActionScript classes you can use in your Flex projects, as well as those available to Flash projects).
- MXML is an XML markup language that makes the creation and layout of visual components of the Flex Framework more intuitive. The XML-style syntax of MXML makes it easy to see what visual components are nested within others. For example, a set of Buttons inside a Panel (a panel is like a window you would find within a desktop application, except it can not be dragged around the screen) may look like:
<mx:Panel title="A Panel Example"> <mx:Button label="Button A"/> <mx:Button label="Button B"/> <mx:Button label="Button C"/> </mx:Panel>
- Flex Builder is a commercial product by Adobe that offers time saving development tools such as a “Design” mode that streamlines the laying out of Graphical User Interfaces (GUIs). It is built upon an open source product called Eclipse, which is a software development tool that originally was for developing primarily Java-based software. In addition to Flex Builder, Adobe offers a “Flex Builder Plugin” for Eclipse, since the two products are so closely related.
- The Flex SDK (Software Development Kit) is an open source package released by Adobe that includes the Flex Framework classes and a compiler (called mxmlc) used to turn ActionScript and MXML source code into a SWF that can then be run inside a webpage, etc. using the Adobe Flash Player plugin. Other tools are included in the Flex SDK such as a tool for creating documentation of the ActionScript class files (asDoc) and a tool for creating SWC files (called compc. SWC files are ActionScript libraries — essentially a bunch of ActionScript classes in a zipped archive, which make them portable for use in other projects).
To see how all these Technologies interact together, check out the Adobe Flash Platform diagram. If you wish to learn Flex I would suggest first having a solid understanding of ActionScript 3.0 and Object-Oriented Programming. The most confusing part to me in the beginning was understanding that everything in a Flex project is ActionScript, even when laying something out using MXML. At the end of the day, there is an ActionScript class behind each component declared in MXML. MXML is just a convenience language, and as such is not necessary to developing Flex applications.