Interacting with ColdFusion Pages

Prior to Flash Remoting, communication between Flash and ColdFusion was a little awkward. On the Flash end, you wrote ActionScript code that called a ColdFusion page via the Flash loadVars object. This object had a method called load( ) that took the URL of a page (in this case ColdFusion) that output variable names and values in a format that Flash could understand. Interaction using this method was fairly cumbersome, on both the Flash and ColdFusion sides. Additionally, it was difficult to pass complex datatypes, such as query record sets, arrays, and structures, between ColdFusion and Flash. Typically, these complex types had to be broken down into simpler name/value pairs before they could be passed. ColdFusion MX and Flash Remoting change this paradigm completely. Combined, these technologies allow you to pass various ColdFusion and Flash datatypes back and forth between Flash and ColdFusion as if they were native datatypes.

If you refer back to the last section of code in Example 28-1, you’ll see that we created a reference to the Flash Remoting gateway by calling the createGatewayConnection( ) method of the NetServices object:

// connect to the gateway
gateway_conn = NetServices.createGatewayConnection( );

Once the connection is established, the next step is to get a reference to a service. In Flash MX-speak, a service is the directory path that contains the ColdFusion page you want to connect to via Flash Remoting. As in Java, the actual ...

Get Programming ColdFusion MX, 2nd Edition 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.