Name

NetServices Object

Synopsis

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 ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.