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

Advertisements