The NetConnection Class

The NetConnection class is available to the Flash Player when you install the Flash Remoting authoring components. A NetConnection object provides you with a proxy through which you connect to the Flash Remoting gateway on the remote server. It also gives you a way to call remote methods. All you need to know is the URL of the Flash Remoting gateway and the methods that you want to access. The NetConnection class takes care of the minutiae involved in making the connection, calling the services, and handling the results.

The NetConnection class contains several methods that can be accessed directly, but they are most often called indirectly through the NetServices class, as shown in the previous chapters. The methods of NetConnection are:

  • connect(url)

  • call(remoteMethod, responderObject[, arg1, arg2,...])

  • close( )

These three core methods are used internally by the NetServices class to connect to and use the Flash Remoting gateway on the server. But what exactly is the relation between the NetConnection and NetServices classes?

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.