Finally Flex 2 & AS3

A few weeks ago I finally got the okay to do a project in Flex 2 / Actionscript 3. While it has been out for a while, and I even downloaded the beta versions of Flex Builder 2 way back in the summer, I found it hard to put enough time into really learning the goodness that is Flex Builder 2 and Actionscript 3. I'm still not done with the project but I've gotten a chance to work with it pretty well and I wanted to share some of my thoughts. ...

At first I approached the project from a pure Actionscript perspective. Coming from my background in Actionscript 2, and reading about it so much for the past several months, it was very easy to get into. Many of the differences are taken care of by the Flex Builder IDE. Now that you need to import all but the top level classes, I thought writing the import statements would be a drag. The developers thought about that and have auto-import statements. It even imports your classes as needed. As long as it can find it in the classpath, it imports it. The few occasions that it doesn't import are a little annoying, because you are so used to it, but very easy to manage since there are so few. By the way auto importing works in Flex/MXML projects.

One of my favorite upgrades is the new display methodology. With most of the stuff I ever wrote in AS2 classes, a MovieClip was overkill for what I needed. The new engine starts with many different types of DisplayObjects before you get to the full functionality of a MovieClip. An even bigger change is the way display objects are handled programmatically. You can have a MovieClip, TextField or Sprite object ( which you can easily create with a 'new' statement ) and you just add it to whatever other DisplayObjectContainer you wish with a simple addChild or addChildAt method call. I haven't run into any depth issues yet either, they are pretty much a thing of the past.

One bit I found annoying though was that you couldn't use any of the flex components and much of the mxml architecture unless you created a flex project. It was annoying at first, but once I surrendered to it I saw why. It's so easy and you can still create a mostly AS3 project if you wish. So this little annoyance was actually a good thing. It got me to start really using the program so I could start programming into the flex architecture rather than just AS3. Once I started things started to go much quicker as well. I actually refactored code that I had been working on for almost 2 weeks in just 2 or 3 hours. Some of it just worked as is and the rest was an easy transition. Very nice.

One big selling point of the new Actionscript Virtual Machine is speed. The only place I've noticed speed increases is in the components. With AS1/AS2 component architecture things were always a few frames behind. So far, these components seem like they are ready to go right out of the gate. I'm sure the new display architecture has a lot to do with that as well as many other improvements.

As of this point be expecting some more posts on Flex Builder 2, AS3 and the new Virtual Machine. Along with approval for this project my boss also purchased a couple of books that so far are very good. Be looking for reviews in the near future.