convertResultHandler in RemoteObject

Many times, while using RemoteObject, instead of processing the result of a remote method invocation in every result handler, you may want a mechanism to process the result before all the result handlers are notified.

convertResultHandler is such a property which was introduced in RemoteObject to process the result before sending it across to all the result handlers.

A sample implementation can be as simple as converting the result to ArrayCollection if its an Array –

public function convertResultHandler(result:*, operation:AbstractOperation):*
// convert result to ArrayCollection
if (result is Array)
return new ArrayCollection(result as Array);

return result;

Livedocs here

A similar property exists for WebService also.
Livedocs here

Loads of new features in Flash Builder 4…

The new Flash Builder 4 (formerly Flex Builder) is out in its Beta. It has loads of new features. Some of them are –
Developer Productivity – Event Handler generation, Getter/setter generation code indentation, file templates, etc..
Debugging – Contitional Breakpoint, Run to line, etc..
Working with data in a brand new way (Data Centric Development) – Connecting to HTTPService, WEBService, PHP, ColdFusion, BlazeDS, LCDS has been made so easy.
Flex Unit Support.
and many more….

Useful links –
Download –
What’s new –
List of Articles –
Don’t forget to log the issues/enhancement you encounter in the bug-base here –

Go ahead, download it and give us feedback to make it better.

Preserving the open nodes in AdvancedDataGrid after re-grouping

Consider a scenario in which you want to group some data and display it in an AdvancedDataGrid. Now, you open some nodes. And you want to add summaries to the data. Adding summaries means to re-group the data by calling GroupingCollection.refresh(). But the state of open nodes will be lost as new Objects are created for the group nodes while re-grouping.

I’m posting a sample in which the open nodes are preserved.

Sample here.

Source here.

Open the sample, click on Group data, open some nodes and then click on Add Summary. The nodes which are open will remain open.

Basically, here I’m giving the same UID for the group nodes as they were before (re-grouping). That’s why, the open state is maintained.

Note: This sample will work only if the grouping fields are same for both groupings. It’ll need some tweaking in case the grouping fields are changed.

Extracting the source from an IHierarchicalCollectionView

When you set Object/Collection as a source for an AdvancedDataGrid to display the source in a Hierarchical manner, the AdvancedDataGrid.dataProvider will return an instance of IHierarchicalCollectionView because internally the source is used to construct a HierarchicalCollectionView which is returned via the dataProvider property.

What if, you want the original source from this IHierarchicalCollectionView. Well, there are some API’s for achieving this –

// First, get the HierarchicalData used to create the HierarchicalCollection
var hd:IHierarchicalData = IHierarchicalCollectionView(adg.dataProvider).source;

//From the HierarchicalData, get the source collection/object
var source:Object = hd.getRoot();

Here is a sample.
Source here.