Rendezvous with technology

convertResultHandler in RemoteObject

Posted on: October 27, 2009

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

About these ads

1 Response to "convertResultHandler in RemoteObject"

This is especially useful when you want to maintain a unique index of models by ID.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: