Benefits

Server-side ActionScript lets your ActionScript engineers use their knowledge of ActionScript to write code for the back end of their Flash applications, which can mean more meaningful levels of interactivity for your users. Your Flash applications can share a library of server-side ActionScript functions, which means you can define functions that are specifically tailored to your own business.

You could, for example, create a server-side ActionScript file that defines a whole library of SQL query methods. With these query methods defined on the server side, your Flash designers only have to invoke the specific query function they want to return data to their Flash MX movies. They do not have to write any SQL, and they do not have to create a new query every time they need to retrieve data from a ColdFusion MX data source. It is a way of creating reusable queries that your entire Flash design team can use.

Coding the ColdFusion MX query and HTTP operations in ActionScript is very straightforward. The CF.query and CF.http functions provide a well-defined interface for building SQL queries and HTTP operations.

For example, the following is a typical server-side ActionScript function definition that returns query data:

// This function shows a basic CF.query operation using only 
// arguments for data source name and for SQL.
function basicQuery()
{
	mydata = CF.query({datasource:"customers", 
		sql:"SELECT * FROM myTable"}); 
	return mydata;
}