Flex 2 Beta 1: The 411

Adobe has released the Flex 2 Beta 1 at the labs. What is Flex 2? Just read the first paragraph if you’re in a hurry.

The big news is that the Flex SDK will include the Flex Framework 2 and the command line compiler (compc) + documentation for free with no licensing or extra charges to develop and deploy applications.

So what’s new & cool and what’s changed from Alpha to Beta? You can find out on the labs, but I’ll go into more detail here.

Flex Enterprise Services 2

Flex Enterprise Services 2 is basically a Remote Shared Object server. Yes, there are other hooks for connecting to various back-ends with the goal of getting the server pushing data to clients, but to me, it’s a bigger deal. For years I’ve been in love with Flash Communication Server, now called Flash Media Server 2, because of it’s Remote Shared Object. Basically, an RSO is an object that has it’s data synced amongst n-clients in real-time. You don’t have to write sync code, you merely get events when it’s updated, and any client can update the object. This is awesome.

However, Flash Media Server, a.k.a. Flashcom, had a lot of feature baggage involved with creating licenses. The majority of the apps I wanted to create had absolutely nothing to do with real-time video and audio conferencing, thus paying for those features seemed dumb. XMLSocket and Jabber are alternatives, but I hate parsing XML, even if it’s abstracted in a library. I like it low-level, simple, and fast. Flex abstracts this into 1 tag. Sick! Even cooler is the ability to use it free of charge for a limited amount of users on a non-clustered server. YUM!

So, I like to think of FMS as Video + Audio server whereas FES is a Remote Shared Object server. My future’s more clear. I know what I’m talking about at MXDU 2007. Let’s hope Influxis.com (or MediaTemple.net) implements this into their product plans. I’d be willing to pay more since this is exactly what I want and need for projects.

Flex Framework 2

The ultimate component set has some new features you can now utilize in the beta. The inline MXML item renderers is basically an easier way to do cellrenderers. Instead of having to create a class and associate with your List or DataGrid, you can now build it inline, meaning pure MXML. A lot cleaner, a lot more centralized, and less dependencies. You can even define an <mx:Script> tag in there to support methods if need be. Dig it.

The layouts for Application and Panel now support the big 3; absolute, vertical, and horizontal. Typically in the past, you’d nest a VBox, HBox, or a Canvas in there to do your layout. Now it’s just a property of the containers which results in less tags, better performance of your app, and faster to design.

Also, you can now make Ghost Children; basically CSS’ visible:none. For Containers, you can now designate children as Ghosts, and they won’t be included in the layout. This makes them tons more flexible since sometimes you want things in a component, but don’t want to be forced to have it included in the layout routines.

Flex Builder 2

You can now treat projects, MXML and ActionScript, as SWC resources. SWC’s are to Flex as JAR’s are to Java. Basically, you can treat your project as 1 big SWC, and all resources, classes, etc. are packaged up into an SWC; a zip file that other projects can then use. This helps when development components and utility classes because it greatly reduces the amount of folders and files in your project, and for larger projects, keeps things modular, more organized. You can now just link to the SWC as a project library. It’s supported for Remote Shared Libraries too, but in my opinion, the infrastructure to keep them organized for large projects isn’t there… yet.

I’ve already talked about the View Source built-in, which is my favorite addition.

The code hinting has gotten tons better. If you type in a class, and it’s not imported, it’ll automatically add the import up top. Additionally, when writing nested MXML tags, it’ll only show the tags that are associated with that component you are currently in which helps a ton if you’ve forgotten the property name, and quickly types it for you.

We also now have the HTML template source in our projects to control the HTML wrapper that our SWF’s are embedded in. The good news is HistoryManager is included in this, but you can also tweak if need be.

The Help is really nice. If you select something, and hit F1, the Help tab will open and show topics for what you highlighted. If you keep it open, and highlight other stuff, it’ll re-search. Don’t forget to highlight the WHOLE classpath; meaning, highligh flash.events.Event instead of just Event.

ActionScript 3

There is the Void to void which I mentioned yesterday. It’s merely a find and replace to change those, although, getting out of habit typing uppercase is hard… 3 years of habit isn’t undone in 1 day.

Object can no longer store undefined, but it can store null. As such a new type, no type, called “*” is introduced. This also has the benefit of telling the compiler, “Yes, I untyped it for a reason, bro, trust me.” So:

private var v:*;

public function f(p:*):*

Is the same as:

private var v;

public function f(p)

Only the compiler will leave you alone for the first one.

The coercion rules are a little weird, so I’ll defer to the docs for those who care.

Event’s have been cleaned up; there are no “Type” classes. Meaning, EventType is gone, and everything is in Event, like Event.COMPLETE for example. Same goes for KeyboardEvent, and MouseEvent, etc. It’s easier to just delete the Type imports up top in your class, then do a find and replace; pretty quick.

Effects now use play and end vs. playEffect and endEffect… less to type! Additionally, they now support pausing, reversing, and resuming. Hell to the yeah.


That’s the good stuff. Yes, ColdFusion now supports ValueObjects, and the Charting Components are there, too. We still need a simplier framework or set of ANT scripts for RSL’s, but I’m still learning all the ramifications and specifications that go into it, so hopefully either someone will blog a solution soon, or it’ll be in the next beta. For a full list of changes, check the docs and the labs site.

BTW, this is where the Flash Platform shows it is a more innovative and useful model vs. AJAX. When new features are released, getting the public to upgrade their Flash Players to the latest version to take advantage of those features happens light years quicker and easier than getting those same customers to upgrade their browser(s). Some numbers to corraborate.

Other bloggers with converage: