Interacting with Server-Side ActionScript
Every
ColdFusion MX server comes with native support for server-side
ActionScript. Server-side ActionScript adds the basic functionality
of ColdFusion’s cfquery
and
cfhttp
tags to ActionScript. As a ColdFusion
developer, you may not have much use for server-side ActionScript;
you’ll most likely find yourself developing CFCs as
the back end for Flash Remoting applications. However, like
everything else, it’s worth understanding how
server-side ActionScript works, as you may find yourself in a
situation where it’s desirable to have a Flash
developer write the server-side code for a Flash Remoting application
as well. Having server-side ActionScript as an option makes it easier
for Flash developers to leverage the power of
cfquery
and cfhttp
without
having to learn ColdFusion.
Server-side ActionScript files are written just like any other
text-based file, and they can be stored anywhere on your ColdFusion
MX server under the web server’s root directory.
Server-side ActionScript files have a file extension of
.asr. In your client-side ActionScript, a
server-side ActionScript file is instantiated by referring to the
file in the gatewayConnection.getService( )
function call. Dot notation is used to point to the server-side
ActionScript file’s location. For example, to
instantiate a server-side ActionScript file called
test.asr located in
webroot/programmingcf/ch28, your client-side
ActionScript would look like this:
var myService = gatewayConnection.getService("programmingcf.ch28.test", ...
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.