View comments | RSS feed

mx.remoting
Class PendingCall



class PendingCall
extends Object

Each call to a service function returns a PendingCall object. The Flash application does not wait for the result of the service function call. The application receives the result asynchronously. You can handle the result by setting the responder property of the PendingCall class to an object that implements the mx.rpc.Responder interface. The Flash Remoting API provides the mx.rpc.RelayResponder. When using the RelayResponder object, you must specify both the object and the methods that will process the result and fault outcomes of the service function call on that object. You can import the PendingCall class using the following import statement:

   import mx.remoting.PendingCall;
   

Example
The following example, which is taken from the CustomerInfoExampleAPI sample application, first imports the Flash Remoting classes that it needs to connect to a service, invoke a service function and handle the result, or possibly the error, that the function returns. The example next creates a Service object, custService, for the customerData service and calls its getCategories() function. The service returns a PendingCall object, pc. The example sets the pc.responder property to a RelayResponder object that specifies the object (this) and methods, (onCategoryData() and onCategoryFault(), to receive the result and fault conditions that the getCategories() method could return. To see the full application, see Using the Flash Remoting ActionScript API in the CustomerInfoExampleAPI application.
   // import Flash Remoting classes
   import mx.remoting.Service;
   import mx.services.Log;
   import mx.rpc.RelayResponder;
   import mx.rpc.FaultEvent;
   import mx.rpc.ResultEvent;
   import mx.remoting.PendingCall;
   import mx.remoting.RecordSet;
   
   // create custService service object to access customerData service
     custService = new Service(
       "http://localhost:8300/flashservices/gateway",
       null,
       "customerData",
       null,
       null);
   
   // call getCategories() method to obtain list of categories and receive
   // PendingCall object in return
   
     var pc:PendingCall = custService.getCategories(); // get all categories
   
   // Set PendingCall responder property to RelayResponder object that specifies
   // the object and methods that will receive the result or fault condition that
   // the service returns
   
     pc.responder = new RelayResponder(this, "onCategoryData", 
       "onCategoryFault" );
   
   

See Also
    mx.rpc.RelayResponder
    mx.remoting.Service



Properties
      responder: Responder  [ Read-Write]
Provides access to the associated responder


Property Detail

responder

responder: Responder  [ Read-Write]

Provides access to the associated responder

Comments


Corstiaan said on Apr 18, 2005 at 3:10 AM :
When using FR for .NET server side, I can use all basic value types as parameters to the method I'm calling. When however I try to call a method and pass a complex object as a parameter, thing fail, but without a warning or Status response... it just stopt.

I have an AS2 class Person and a C# class Person. I'm calling:
var pc:PendingCall = this.remoteservice._save(this); // this is an instance of Person class

When I try to call the overloaded method wich only receives an integer, it works, so all classes and remoting are correct and connected. What is missing?

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flashremoting/mx2004/actionscript_api_reference/mx/remoting/PendingCall.html