662
Chapter 30: Using Server-Side ActionScript
Submitting user data to the Flash Remoting service
To send data to server-side ActionScript, you must create a function that passes the data from the
Flash movie to server-side ActionScript. The
search
function, applied at the frame level, collects
the user-entered data from the firstName and lastName text boxes and passes the data as function
arguments to the directoryService object, which is created when the Flash movie connects to the
Flash Remoting service. For more information, see
“Checking for a Flash Remoting service
connection” on page 663
.
The following is a Flash MX ActionScript example:
#include "NetServices.as"
function search()
{
// The search() method is defined in the server-side AS file
directoryService.search(firstName.text, lastName.text);
dataView.setDataProvider(null);
status.text = "waiting...";
}
Reviewing the code
The following table describes the code and its function:
Capturing Flash Remoting service results
When you create a function that calls a server-side ActionScript function, you must also create a
function to handle the data returned by server-side ActionScript. Define the function with the
same name as the function making the initial call, but you append
_Result
to the name.
For example, if you create a function called
basicQuery
to return query data, you also need to
define a results function to handle returned data; declare the results function as
basicQuery_Result
.
In the following example, the results function
search_Result
supplies the record set to the
dataView.setDataProvider
function:
function search_Result(resultset)
{
dataView.setDataProvider(resultset);
status.text = (0+resultset.getLength())+" names found.";
}
Code
Description
directoryService.search
(firstName.text, lastName.text);
Passes the contents of the firstName and lastName text
boxes to server-side ActionScript.
dataView.setDataProvider
(null);
Clears the
dataView
list box component.
status.text = "waiting...";
Displays a message in the status text box while the
record set is being retrieved from server-side
ActionScript.
Summary of Contents for COLDFUSION MX 61-DEVELOPING 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: ......