Handling Results For A Connection Object; Directing All Results For A Service To A Single Responder Object - MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Use Manual

Using flash remoting for flash mx 2004 actionscript 2.0
Table of Contents

Advertisement

Handling results for a Connection object

When you use the methods of the NetServices object to create a gateway connection and obtain a
Connection object, you use the
you access a service using the methods of the Connection object, you can either direct all results
for a service to a single object or direct the results of a specific service call to a specific result
handler.
Note: Do not specify a responder object in the
service function call. If you specify the responder in both places, Flash Remoting passes the
responder you specify as an argument to the service function. This behavior causes errors in your
application.
When you test an application in Flash during development, if there is no appropriate responder
object method, Flash displays the results in a message window.

Directing all results for a service to a single responder object

You can direct all results for a service to a single result handler by specifying a responder object as
the second argument of the
Connection.getService()
HelloResponder
howdyService=gatewayConnection.getService("remoteservices",
new HelloResponder()); // responder
You can direct results to a specific method in the result handler by providing a method with the
name
serviceFunctionName_Result()
service method.
Any results that are not directed to a specific result handler method are directed to the
method.
onResult()
Use this technique if all the following conditions are true:
The results of calls to one function name must be handled differently from the results of calls
to another function.
All functions in all services that require different handling have unique names. For example,
you do not use two services with identically named functions, such as
myFirstService.myFunction
processing.
The results of all calls to a particular function in a service can be handled by a single responder.
The following example shows how you can use the main SWF file as the responder and have a
common
onResult()
functionName_Result
specific result handlers, the
display the returned message in specific text boxes. The default
displays the result in the Output panel.
import mx.remoting.NetServices;
import mx.remoting.Connection;
Connection.getService()
getService()
method to access the
as the responder object to receive the results.
and
myOtherService.myFunction
method result handler for some service functions, and function-specific
handlers for other functions. In this example, there are two function-
helloWorld_Result()
method to access a service. When
gatewayConnection.getService()
method call. The following example uses the
remoteservices
, where
serviceFunctionName
and the
whatsUp_Result()
Handling results for a Connection object
method and in the
service and specifies
is the name of the
, that require different
method, which
response handler
onResult()
167

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash remoting mx

Table of Contents