Flex 2.0 beta 1
March 17th, 2006 by Sonja DuijvesteijnFlex is a development framework by Adobe and is meant to help developers make applications. That means, no timeline, no graphics, no animations. After making a flex application the source will be compiled into a .swf file, which can be put online and viewed just like regular .swf’s.
Framework
Flex is a framework, and as such offers help in building bigger things. A great example of this is the flickr application that can be build in 5 minutes. By using the API from Flickr it is extremely easy to make a search image tool in flex. At least, in the tutorial video it is.
Flex has a lot of components that make it easier to make applications in Flash. Amongst the things that the flex framework can do are the Textarea, which is a well, textarea, including scroll functionality. But also navigational elements are introduced. Tabbed windows, accordion type lists and a menu bar.
MXML
Components aren’t all that’s new in Flex 2. MXML is an xml based mark-up language with which you can position the components on the stage. But also add actions to it, and eventhandlers. And as it should with an xml based language you are allowed to make your own components and use them with mxml. Now MXML was there in flex 1 and 1.5 as well, but a lot of adjustments have been made.
An example from macromedia.com:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:TextInput id="source" width="100" text="Enter text here"/>
<mx:Button label="Copy" click="destination.text=source.text"/>
<mx:TextInput id="destination" width="100"/>
</mx:Application>
There is no working example of this since this needs the flash player 8.5 and that is, like flex, still in beta.
This piece of code puts two input fields on the stage of which the top one has a text ‘enter text here’, and a button. Notice that there is no x and y coordinates? That’s because you can now add objects inline just like html. The button has a click event applied to it. That event is plain actionscript and copies ’source.text’ to ‘destination.text’.
Actionscript 3
Something that’s brand new in Flex is actionscript 3. And it really is object oriented this time around. So, start writing classes, and make things easier to manage in the long run. Other than that they’ve added numerous new functions and functionalities.
Another difference with actionscript 3 is the way it is used by the player. AS2 was transformed into AS1, and then compiled. That way everything was backward compatible. But a lot of speed was lost on this. Actionscript 3 is no longer backward compatible, and as such cannot be compiled for a lower player version than 8.5. The good thing about is that this player is a lot faster. Unfortunately, most people don’t even have flash player 8 installed yet, and it will take some time before flash player 8.5 is common enough to use flex for widely used applications.
Good news
There’s a free version. The wise folks at Adobe decided to let people use flex 2 for free. Meaning, more people will use it, and more examples will be available. In contrast flex 1 cost $12.000 for a dual-cpu license. Well, obviously that wasn’t a program for general use. There will be a buyable flex 2 version too, and that includes server side technology. Which can be compared to the flash communications server.
Conclusion
So, should you use it? Well, not yet I think. A lot of the documentation still needs to be written and it’s hard to find good examples. Also, since the flash player 8.5 has to be installed to see the compiled swf it’ll take some time before most people will be able to see your application. There is real potential in flex 2. However, at the moment I wouldn’t advise doing anything major with it. But keep your eyes on it for the future.
Related posts
Flex 2 beta 3
Flex 2.0 beta 2
Flash and search engines