Flex: a Flash developer point of view
I have been working with Flash for about 10 years now, I have seen it growing and improving over the years and I became very familiar with that piece of software. Flash is a familiar working environment and when I start developing I know where I need to go and I know how to get there. It took a lot of time and patience, actionscript has changed over the years and I have also felt frustration at times but I have always managed to do what I wanted to do with Flash and I could not see a reason to change the way things were.
I used to think that way but I now use Flex Builder as much as I use Flash, and I want to tell you why I changed my mind.
A discrete newcomer
When I first heard about Flex I must say that I did not pay too much attention to it, especially that it came as a SDK without user interface and since I have never been a big fan of command lines it didn' help to attract me. Also Flash CS3 wasn't released at that time and therefore my AS3.0 experience was pretty poor.
Then came Flex builder, a product with a user friendly interface built on top of the Flex SDK. I decided to give it a go and installed a demo version and I have to say it wasn't love at first sight, no timeline, no design tools, a strange way of mixing MXML tags and Actionscript. All that seemed a bit confusing to me and I could not see the point of learning a software to develop applications that I could already develop entirely in Flash therefore at that point I did not spent too much time with Flex and went back to my first love.
Developing RIAs with Flash
At that time I was working in an e-learning company and was working on a couple of applications involving live data, those applications would probably fall today in the RIA (Rich Internet Application) category. I had decided to use Flash since I was very familiar with the software and actionscript 2.0 at that time. As I was moving along in the development I quickly realised that, although Flash had a fair amount of useful components, it was still necessary to write a lot of code to deal with simple data operations and to adjust the display to the data changes. After a fair amount of trials and errors I finally reached a satisfying result, but I was left with a feeling that if I had to do it again I might have a second look at Flex that was apparently perfectly adapted to the development of RIAs. I was especially looking for a way to simplify my workflow and enhance my productivity.
After that experience of developing my first RIAs in Flash, Flash CS3 was released and, as I was starting to fiddle with AS3.0, I thought it would be a good time to have a second look at Flex. This time I wasn't just driven by a simple curiosity but I was really looking for some precise answers. I had met precise problems with Flash and I wanted to see if Flex would help me to solve them more easily. At the end of the day I am a developer and what I worry about is scalability, reusability, maintenance and productivity and I wasn't so sure that Flash was the best way to solve those issues when it comes to develop RIAs.
Why Flex Builder is more suited to application developement
I have now been using Flex for a while and I love it :) I suddenly realised that if it is for me the perfect tool to develop RIAs. Don't worry you can develop RIAs in Flash, there is nodiscussion about that but Flex will vastly enhance your productivity.
I have highlighted below a couple of points that I think are worth considering before you choose to use Flash over Flex to develop an RIA.
Interface creation
Assembling an interface in Flash with the built in components can be a bit of a chore, you have to create containers yourself and assemble the interface hierarchy by hand. In Flex I have to say that it is a lot easier. Flex has a lot of Layout components that will let you assemble and build an interface in no time at all. the main reason of MXML in Flex is to simplify the interface creation and it does its job wonderfully. Since MXML is tag based, very much like HTML and XML, you can also assign events, properties value and id (instance name) directly in the tag as attributes. When you compile your application MXML is then converted into Actionscript code. In Flash you would have to write it all in Actionscript 3.0 directly there would be no way around.
Skinning and CSS
If you are not happy with the default look and feel of the flex components you can define their style in a CSS document and you don't even have to do it manually it is all done through the Flex Builder Interface, just with one click you can assign a style to a set of components. If you have ever work with CSS in Flash I am sure you understand the beauty in this.
Along with being able to create styles you can also skin your components with graphics and again it can all be done through the Flex Builder interface, in a couple of clicks you can see the boring default look and feel turn into a colorful personalized component.
Data Binding
If you were looking for only one good reason to move to Flex to develop RIAs it would be data binding. Data binding means that you can associate a piece of data with a component and whenever the data is updated from wherever in your application the view on that component will refresh to display the modification. Basically this means that you can concentrate in the code in the background without worrying on the view and trust me this is a feature that you will miss when you go back to Flash.
Since RIAs are nearly always fed with live data this feature really is a must have to enhance your productivity and take away a lot of worries.
States
I see the states in Flex as a replacement from the frame based timeline of Flash. Basically in Flash you would move to another frame of a graphic element to display another visual state. In Flex this is done through states and it is very quick to understand how it works. Instead of using a in Flex you would use , the concept stays the same.
A rich set of components
In Flash I have to say that I tried to avoid as much as possible to use the default components, the main reason being that they were adding quite a lot to the file size and most of the time I did not need all of the features that they were offering. I prefer instead to develop my own lightweight components that are doing just what they need. When it comes to develop RIAs it is another story, you need a powerful set of component that needs to be very functional and work well together and Flex Builderprovides just that. Flex Builder also has some nice components like the charting set that are a great addition to the original set.
Flex and Flash are not competing products
Flex and Flash are two different tools and the task you have to accomplish will determine which one is the best for the job. If you are planning to create a lot of graphics and animation Flex is not the best tool to choose but Flash is a best choice. If you need to develop a web application with a lot of control and involving display of dynamic data then you'll have less worry if you use Flex. At the end of the day I use them both equally, I create the core interface and engine in Flex and then use Flash to add design and animations if necessary.
If you are a Flash developer wondering if you should start checking what Flex is all about then I would suggest you have a look at it, you might never need it but you want to make sure that you understand exactly what it does and how it does it, you never know. Even if you are just a Flash designer you might have to work with Flex developers and it won't hurt to have a look at it. Personally I am glad I had that second look at it, I am not using it because it is the "new thing" but because It simplifies what I have to do and it's all I care about.
|