Flex - Handling collections from a web service call in object format

We recently started an internal project and this time decided to use Adobe's Flex RIA (Rich Internet Client) technology for the front-end. We last used Flex on a project about a year ago and it is great for flashy web front-ends.

We evaluated a bunch of RIA technologies and found none really that we liked. Our criteria being open sourced and well supported. Maybe JavaFX wil be the one.

Adobe has gone some way to open source their products. The Flex SDK has been open sourced for some time, under the Mozilla Public License and so is Adobes Blaze Data Services data services component under the LGPL. 

I am a bit uneasy about the proprietary nature of the platform mainly because

  • it has poor support for Linux and I dont want to be forced into a  Windows world,
  • because when something is based on proprietary technology there is a definite lack of choice in tools and libraries. For example we like to use Maven for our build processes and with many proprietary products you are left with their way or now way,
  • when someone else controls the standard who knows what they going to do with it.

I reckon that in the long run market forces will ensure that the whole of the platform is open sourced with all its benefits just like SUN has realised with Java.

Handling WebService list results in object format

We had a look at Blaze DS for the project but its lack of tool support for Linux meant that it was a bit of  a mission to manually setup and configure and the documentation seemed a bit thin so we went with Java based web services. (We evaluated Hessian too and I will post a blog on our findings later.) Last time we used Flex we used the e4x format for returned objects and this time we decided to use the object format.

 When the format is in object format and the web service returns a List object we found out that trying to use the "for (var obj:Object in result)" construct did not work. Instead we had to use an old fashioned for loop iterating over the index of a simple array like so:


var customers:ArrayCollection = new ArrayCollection();
if (obj.result.length==null){
var customer:CustomerVO = new CustomerVO();
customer.loadFromObject(obj.result);//custom method on value object to load from soap response
var length:Number = obj.result.length;
for (var i:Number=0;i<length;i++){
var customer:CustomerVO = new CustomerVO();
return customers;

 Sometime the approach of Flex and Actionscript seems inconsistent to me.Why not just  provide us with something that extends the ArrayCollection class? It reminds me of the early days of Java when there was still a lot of use of primitive types, a hang over from the pre-object orientated days.

Maybe its not Flex/Actionscript and its just my lack of experience and poor tools.