Friday 13 March 2009

Adobe Flex

I finally got around to trying this out over the last few days, and I have to admit I was surprised by how much I enjoyed the experience. To start explaining, I'll first detail a bit about what Flex is.

Flex is the free, open source SDK for creating Flash applications (or rather swf applications). It does away with that annoying 'timeline' concept thats used in Flash animation, replacing it with a very nice, very functional XML layout format with the ability to embed ActionScript 3 code into the layout. Add onto this the Flex Builder IDE (based on Eclipse, and unfortunately not free, but it does have a free 30 day trial version) with extremely useful code completion and all the nice organisation features I'm used to with IDE projects and you have an environment that makes it, speaking plainly, just makes it easy and fun to do things.

So, to start with, my initial thoughts upon trying Flex were dubious. I've never really liked Flash and have always had the mental model of it being an 'animation package' that shouldn't be used for mainstream web applications. I guess Adobe realised this, which is why they hid animation features in Flex to make it more a mainstream programming language. For reasons I don't want to get into here, I had to put this aside and actually try to create something useful with the language.

After about an hour of downloading(1) and then finding the 'Flex in a week' tutorials on Adobe(2) and I was set up, ready to start producing these hated flash applications. About 30 minutes later, I had a grasp of how to layout the XML applications (using the MXML library), how to link that into ActionScript code to do... whatever... and about 10 minutes later, even how to request data from a website and push that into my application to populate list controls. It was easy, despite having never done any AS coding before and having the barest grasp of the syntax. The tutorials didn't even cover the syntax. It assumed you were clever enough to pick it up by osmosis (a welcome relief I can tell you... I don't mind learning a new syntax, but being told for the 50th time that 'this is a for loop, you use it to iterate over something N times' is not something fun) and concentrated on the stuff that would be less familiar to a programmer first coming to flex - specifying a layout with XML, the conventions used, how to link to services, the event model of Flex and how to specify custom events, etc.

So, I haven't gotten through the complete 'week' course yet, but I rushed through the first two-and-a-half days fairly quickly before deciding to create something 'useful'. I decided that what I would try is a custom Flash reader for my wife's hamster comic strip, HAMIC. I used what I had picked up to request the RSS feeds (that I had created, and modified slightly to throw out some extra stuff I needed) and used my newly found knowledge to create the reader in about a day. I then modified it again to add the ability to create and update comics using a similar interface to the web interface on the actual site. I ran into a couple of small issues that helped me understand what the framework does better (such as when controls get instantiated, how bindable data works a bit better and so forth) but overcame them (apart from one small issue with single comics in a category... but we won't mention that ;)). I may end up doing a lot of web-related stuff as a job soon (fingers crossed, I really need a job right now) and this was the first step towards that goal.

It's certainly a far cry from Symbian, and that's almost certainly a good thing :) It's definitely made me re-evaluate my views on Flash technology.

(1) Flex builder 3 trial - http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex3email

(2) Flex in a week video training course - http://www.adobe.com/devnet/flex/videotraining/

(3) The reader I created, for anyone interested. Please be nice to it, it's only a new app - http://flextestsite.workmad3.com/HAMICFlex/index.html

No comments:

Post a Comment