NetServices Object

NetServices ObjectFlash 6

simplifies connection management
NetServices.methodName(params)

Methods

createGatewayConnection( )

Creates a NetConnection object to allow connection to remote services through the Flash Remoting adapter on the server.

getVersion( )

Returns the current version number of the NetServices object (currently 1.0).

setDefaultGateway( )

Sets a default URL for a NetConnection object.

Description

The NetServices object abstracts some of the NetConnection class's functionality for easy access to the developer. Using the simple methods of the NetServices object, you can set up a gateway URL and create the NetConnection object. The NetServices object also aids in the creation of callback functions for remote services and creates proxies for the remote connections.

The NetServices object is included when you include the NetServices.as file in your Flash movie:

#include "NetServices.as"

You use the NetServices object directly; you don't construct an instance of the object. Typically, you use it to specify a default URL and create a NetConnection object:

NetServices.setDefaultGatewayUrl("http://127.0.0.1/flashservices/gateway");
var my_conn = NetServices.createGatewayConnection( );

Once you use the NetServices object to set up an instance of a NetConnection object, you should not have to use the NetServices object anymore. The benefit of using the NetServices object is that you have more control over your connection and responder objects. This is discussed in the individual method sections for NetServices in this chapter.

See Also

The NetConnection class; Chapter 4



    Part III: Advanced Flash Remoting