652
Chapter 30: Using Server-Side ActionScript
About server-side ActionScript
Macromedia ColdFusion MX includes a module called the Macromedia Flash Remoting service
that acts as a broker for interactions between Macromedia Flash MX and ColdFusion MX. Flash
Remoting supports a range of object types, and lets you reference an ActionScript file that lives on
a ColdFusion server. You can partition data-intensive operations on the server, while limiting the
amount of network transactions necessary to get data from the server to the client.
Flash developers can create server-side ActionScript files to access ColdFusion MX resources; they
do not have to learn CFML (ColdFusion Markup Language). This ability lets you logically
separate the Flash presentation elements of your applications from the business logic. You have
the option of creating ActionScript files that reside on the server to partition this processing away
from your client applications.
You have a very simple interface for building queries using server-side ActionScript, and an
equally simple interface for invoking these queries from your client-side ActionScript.
Client-side ActionScript requirements
On the client side, you only need a small piece of code that establishes a connection to the Flash
Remoting service and references the server-side ActionScript you want to use.
For example (note embedded comments):
// This #include is needed to connect to the Flash Remoting service
#include "NetServices.as"
// This line determines where Flash MX should look for the Flash Remoting
service.
// Ordinarily, you enter the URL to your ColdFusion server.
// Port 8500 is the Flash Remoting service default.
NetServices.setDefaultGatewayUrl("http://mycfserver:8500");
// With the Flash Remoting service URL defined, you can create a connection.
gatewayConnnection = NetServices.createGatewayConnection();
// Reference the server-side ActionScript.
// In this case, the stockquotes script file lives in the web root of the
// ColdFusion server identified previously. If it lived in a subdirectory
// of the web root called "mydir," you would reference it
// as "mydir.stockquotes".
stockService = gatewayConnnection.getService("stockquotes", this);
// This line invokes the getQuotes() method defined in the stockquotes
// server-side ActionScript.
stockService.getQuotes("macr");
// Once the record set is returned, you handle the results.
// This part is up to you.
function getQuotes_Result ( result )
{
// Do something with results
}
Note:
Client-side ActionScript does not support the two new server-side ActionScript functions,
CF.query
and
CF.http
.
Summary of Contents for ColdFusion MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......