When you use a service connected to db’s methods (get data from db) in flex you have to use rpc calls to get the data. When you just fire service.getSth() method it will return an AsyncToken object with nothing in AsyncToken.result field.
One way is to do something like this:
var resultObj:AsyncToken;
var responder:AsyncResponder = new AsyncResponder( resultHandlerAddInfo, faultHandlerAddInfo );
//resultObj = testService.getTestIDForSpecLogId(int(logIDForViewingAddInfo));
resultObj = testService.getAdditionalInfoForSpecLogId(int(logIDForViewingAddInfo));
resultObj.addResponder( responder );
public function resultHandlerAddInfo( event:ResultEvent, token:Object=null ):void
{
//Alert.show( "RESULT: "+ event.result as String );
var rpcRes:String = event.result as String;
FlexGlobals.topLevelApplication.viewLogAddInfoVar.addInfoTextArea.text = rpcRes;
}
public function faultHandlerAddInfo( event:FaultEvent, token:Object=null ):void
{
Alert.show( "FAULT: " + event.fault.message );
}
Very nice way to get result from AsyncToken.
ReplyDeleteIt really works....
Thanks a lot...