Archives of August 2009

Remote requests of data could cause available errors in dataprovider collections like ComboBox.

These errors are because of the data is not locally available so the request is asynchronous. The situation dispatchs an ItemPendingError.

This error can be managed with ItemResponder class, so ours logic can be executed when the request is completed (or not).

A simple example:

try {
    groupCollection.getItemAt(0);
} catch (ipe:ItemPendingError) {
    trace("item pending error fetching admin.");
    ipe.addResponder(new ItemResponder(
        function (result:Object, token:Object=null):void {
	    groupCollection.getItemAt(0);
        },
	function (fault:Object, token:Object=null):void {
	    trace("Error while loading");
	},
        {info:"..."}
    ));
}

The ItemResponder class object can also lets you provide data (a token) to be used by the responder methods.

  • Share/Bookmark
Creative Commons License
This blog is under Creative Commons licence, unless indicated otherwise.
Special thanks to Mark James for the icon set used in this blog.