User Guide

Table Of Contents
Building a simple application 835
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.";
}
Reviewing the code
The following table describes the code and its function:
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.
Code Description
function search_Result
(resultset)
The _Result suffix tells the Flash Remoting service to
return the results of the search function to this function.
dataView.setDataProvider
(resultset);
Assigns the results returned by the Flash Remoting
service to the
dataView list box.
status.text = (0+resultset.
getLength())+" names found.";
Displays the number of records returned by the Flash
Remoting service.