To ensure that the Flash movie is connected to the Flash Remoting service, you use an if statement; for example:
if (inited == null) { inited = true; NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/ gateway"); gateway_conn = NetServices.createGatewayConnection(); directoryService = gateway_conn.getService(personneldirectory, this); status.text = "Type into the text boxes, then click 'Search'"; }
In this example, the inited variable is evaluated for a value. If inited is null (not connected), the movie connects to the Flash Remoting service using the NetServices object. For more information about connecting to the Flash Remoting service, see Connecting to the Flash Remoting service.