Flex Out Of The Box

Flex is well suited to rapid prototyping, so let's start building an application! The goal of this section is to illustrate the capabilities of Flex 2 right "out of the box" by developing an application by using the existing Flex 2 component set.

This Short Cut does not cover using the design mode of Flex Builder 2. All of the examples can be typed in the MXML editor of Flex Builder 2 or the text editor of your choice and compiled with the Flex 2 SDK.

Furthermore, this Short Cut will get your feet wet with the most important classes but is in no way an exhaustive manual. Your first stop for more information on the classes available in the Flex framework should be the Flex 2 documentation available on http://www.flex.org and bundled with your copy of Flex Builder 2. When in doubt, RTFM!

All Flex is ActionScript

While you may be anxious to get coding, there is one concept that will help you tremendously if you understand it before writing your first line of MXML: all Flex is ActionScript, even MXML.

When you compile your Flex 2 project, your MXML files are actually turned into ActionScript 3.0 files as an intermediate step on the journey to a SWF. Anything that you program in MXML, you can program in ActionScript. MXML is a language in its own right, but you can think of it as another way of writing ActionScript. Below are the rules that define MXML.

Tag Names

When you write <mx:Button/> you're really just talking about the Button class. Write three <mx:Label/>s and you ...

Get Introduction to Flex 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.