
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.
Содержание COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...