Specifying The Gateway In The Netservices Creategatewayconnection() Method; Using The Netservices Setdefaultgatewayurl() Method - 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

You can also combine these techniques. If you do so, the gateway URL is determined as follows:
A URL specified in a
1.
other URL.
A URL specified in the deployed web page takes precedence over a default gateway URL.
2.
If you do not otherwise specify a gateway URL, Flash Remoting uses the gateway specified in a
3.
NetServices.setDefaultGatewayUrl()
Macromedia recommends using the
the gateway that you use in the Flash authoring environment. Doing so lets you test your Flash
Remoting application directly in the development environment, without having to change your
code when you deploy your application. When you deploy the SWF file, supply the production
gateway URL in the web page that you use to run the Flash application. This way, you also do not
have to make any changes in your Flash application to deploy the SWF file on different
application servers.
Specifying the gateway in the NetServices createGatewayConnection()
method
You use the
createGatewayConnection()
gateway. For example:
import mx.remoting.Connection;
import mx.remoting.NetServices;
// farther in the application . . .
var gatewayConnection:Connection = NetServices.createGatewayConnection("http:/
/apps.mycompany.com/flashservices/gateway");
The gatewayConnection object returned by this method is the Connection object for the
connection. You can use this object to set security credentials, if required, and to access the Flash
Remoting service or services that you will use.
This technique has the disadvantage of using a hard-coded URL. To change it, you must change
the ActionScript, and publish and deploy your SWF file.

Using the NetServices setDefaultGatewayUrl() method

The
setDefaultGatewayUrl()
createGatewayConnection()
URL. For example:
import mx.remoting.NetServices;
import mx.remoting.Connection;
NetServices.setDefaultGatewayUrl("http://apps.mycompany.com/flashservices/
gateway");
var gatewayConnection:Connection = NetServices.createGatewayConnection();
Because you set a default gateway URL, you do not always need to specify the gateway URL
elsewhere. However, you can override the default value by specifying a gateway URL in the
createGatewayConnection()
164
Appendix A: Using NetServices and Connection Classes
createGatewayConnection()
method.
setDefaultGatewayUrl()
method to configure a connection to a specific
method sets a default value for the gateway URL, which the
method uses if you do not supply the Flash Remoting service
method or in the web page that calls your SWF file.
method takes precedence over any
method to specify the URL of

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