A Beginners Resource Guide to Flex for Flash Developers
Having been a Flash guy for many years, I was always reluctant to tackle the move to Flex. I saw it as something that was only good for super large, creativly dry, data-driven applications. I was of the mind set that for experience driven, creative masterpieces, like you often find in the advertising world, were only to be tackled using the Flash IDE.
Well, as with most of my hard-line opinions. I was wrong...
It is the purpose of this post to document the things I've learned (so far) along the road to adopting Flex. If you're looking for a step by step guide to learning Flex, you'll find links to other resources below far better than ones I could come up with. Hopefully if you're new to Flex, and looking for a place to start making the transition from Flash, you will find this post a helpful jumping off point.
Flex, Flash, and the Flash Platform
There is a fair amount of discussion going on right now within the Flash/Flex world regarding the definitions and boundary lines of these terms. Lee Brimlow has written a great article which defines the official direction that Abobe is taking.
As I see it, Flex is a framework. It's a framework for building Flash applications (or RIAs [Rich Internet Applications] if you prefer). It uses Actionscript 3 as it's base, and includes all of the same functionality that Flash developers are used to when developing pure AS3 applications in the Flash IDE. In addition to Actionscript 3, Flex also features an XML tagging language called MXML which is basically just a convenience markup language for instantiating AS3 based objects.
One more point of clarification is tools used to build Flash/Flex applications. At one point I was under the impression that in order to develop Flex applications, I had to use Flex Builder (which is based on the Eclipse IDE platform). Well, at one point I thought that the only way to build Flash movies was to use the Flash IDE. Not true. Personally I like to use Textmate to code applications and use the Flash IDE to layout the presentation layer of my application. So the same applies to Flex. You can code Flex applications in whatever text editor you'd like. The free Flex SDK includes all of the features of the Flex framework, and compilers needed to build the SWFs, but none of the Flex Builder stuff. Flex Builder just has lots of great debugging, code completion, and other handy features to speed up development of Flex RIAs.
So How Do I Get Started?
Here are some of the resources I used to get familiar with the Flex framework and Flex Builder:
- Flex In a Week Video Tutorials
This series of video tutorials is fantastic. Thank you Adobe. If you have the opportunity to go through a few of these each day, you will be up to speed on Flex in no time. I also will use these as reference, since they are divided into such logical chapters.
- Tour de Flex
Tour de Flex is more of a reference tool more than a tutorial. It provides background, and examples of implementing various Flex UI components. It comes packaged as an AIR application, and is written using the Flex framework itself.
Frameworks for a framework? Huh?
Yep, even though Flex itself is a framework, it's more of a library of classes, components, and helpers. It does not actually provide you with a application design pattern. Most people agree that some kind of MVC architecture is the way to go for medium to large applications (for small components an MVC architecture may be unnecessary). There are several Frameworks out there that help you to implement the MVC pattern. Currently there are three front runners, which one is best is a hotly contested topic in the community, here are some brief descriptions, make your own opinion:
Cairngorm is the official framework endorsed by Adobe. It's well documented and well suited to team development. It follows a very methodical approach to application development. It is currently my framework of choice, but that may change as I explore others more.
- Pure MVC
Pure MVC is a language agnostic MVC framework, which has it's roots in Actionscript, but has been ported to many other languages.
Mate is not nessisarily an MVC framework. It is a pure MXML framework which mainly helps to route events to the classes you want. It does not force you into a specific application design, but can be used to easily create an MVC achitecture of your choice.
For more information on the pros and cons of these frameworks, read this article written by Jeremy Wischusen
The Marriage of Flash and Flex
So this was something that baffled me for some time. I was so used to building interfaces and UI components in the Flash IDE, that I could not see how I would be able to create beautiful things in Flex. Enter Flex Component Kit. Click Here to download it (you'll need a devnet login to grab it).
This is what did it for me. Made me take the final steps towards embracing Flex. With this extension to Flash, you are able to build UI components in the Flash IDE, and then export them as Flex compatible components.
There are several great resources out there for learning how to use it. Glenn Ruehle, the creator of the extension put out a great video presentation on the capabilities and processes of using the tool. Also there are several great blog entries on using the tool.
Wrapping it all up
So this is just a quick run through of what I've used to get up to speed on Flex. I welcome any questions that you might have, that I may have missed. I'll do my best to answer. Also, if any of you more experienced Flex guys out there want to add anything, please do. I'm stoked to learn more about the technology