Using the Flash Remoting service with server-side ActionScript

The ability to create server-side ActionScript provides a familiar way for Flash developers to access ColdFusion query and HTTP features without learning CFML. You can place ActionScript files (*.asr) on the server that you want to call from the Flash application anywhere below the web server's root directory. To specify subdirectories of the webroot or a virtual directory, use package dot notation. For example, in the following assignment code, the stockquotes.asr file lives in the mydir/stock/ directory:

stockService = gatewayConnnection.getService("mydir.stock.stockquotes", this);

You can also point to virtual mappings, such as cfsuite.asr.stock.stockquotes, where cfsuite is a virtual mapping and asr.stock is a subdirectory of that mapping. The CF.query and CF.http functions give you a well-defined interface for building SQL queries and HTTP operations of ColdFusion.

For example, the following server-side ActionScript function definition returns a RecordSet object:

function basicQuery()
{
  mydata = CF.query({datasource:"customers", 
    sql:"SELECT * FROM myTable"});
  return mydata;
}

Note:   For more information about server-side ActionScript, see Using Server-Side ActionScript in ColdFusion.

Comments