Right, I'd much rather see people start out with normal AS3
functions to
simplify things until they get a handle (pun intended) on the
nature of async
programming.
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.AsyncResponder;
private function doFill():void
{
var token:AsyncToken = dsDataService.fill(arrayList);
var responder:AsyncResponder = new
AsyncResponder(handleResult, handleFault);
token.addResponder(responder);
}
private function handleResult(event:ResultEvent):void
{
trace("Result received. Length = " + arrayList.length);
// Handle result.
}
private function handleFault(event:FaultEvent):void
{
// Handle fault.
}
See
http://livedocs.adobe.com/flex/201/langref/mx/rpc/AsyncResponder.htmltoo.