Before you can use functions defined in your server-side ActionScript, you must first perform several initial set up tasks.
First, you connect the Macromedia Flash movie to the server-side Flash Remoting service. The following steps create a Flash Remoting service connection:
NetServices.as in your Flash movie. 
See the following sections for more details:
After you perform this setup, you can use the functions defined in your server-side ActionScript.
   You must include a series of ActionScript classes in the first frame of the Flash movie that will be using server-side ActionScript functions. The following command includes the NetServices class:
#include "NetServices.as"
   The following command includes the NetDebug class:
#include "NetDebug.as"
   The NetServices include statement is required for server-side ActionScript. The NetDebug include statement is optional. 
The Flash Remoting service serves as a broker for calls to server-side ActionScripts.
To use server-side ActionScript:
NetServices.setDefaultGatewayUrl function; for example:NetServices.setDefaultGatewayURL("http://localhost:8100/flashservices")
You must specify a ColdFusion MX Server hostname. The default port number for the Flash Remoting service is 8100.
NetServices.createGatewayConnection function; for example:gatewayConnection = NetServices.createGatewayConnection();