Using the Flash Remoting ActionScript API in the CustomerInfoExampleAPI application
51
Establishing the connection in the HTML file enables you to change it without needing to
republish the application.
After creating the
custService
Service object,
CustomerInfoFormAPI()
calls the c
ustService.
getCatergories()
function to retrieve a record set of all categories, sets the alignment for the
Total Sales label on the DataGrid component, and assigns a RelayResponder object to the
responder
property of the
pc
PendingCall object for the call to
getCategories().
The
RelayResponder specifies the object (
this
), the result handling method (“
onCategoryData
”),
and the fault handling method (“
onCategoryFault
”) that will handle the result or fault
condition returned by the
getCategories()
function. RelayResponder calls
addEventListener()
to register the
onReveal()
method, the method to call when a
reveal
event occurs.
onReveal()
The
onReveal()
function performs initialization tasks for the CustomerInfoFormAPI class if the
initialization
variable is not equal to
true
. These tasks include defining the columns (
"ID"
,
"Active"
,
"Name"
, and "
TotalSales"
) for the DataGrid component that displays the customer
information returned from the customer’s database. The next line, shown here, registers the
onCustGrid_Change()
function as the event handler to be called if a change occurs in the
customers_grd
DataGrid component.
customers_grd.addEventListener( "change", onCustGrid_Change );
Next, the
onReveal()
function aligns text for the Total and the Total Sales labels and sets the
initialized
variable to
true
.
updateDetails()
The
updateDetails()
function updates the data displayed in the Customer Details section
when the customer selected in the DataGrid component changes. This information includes the
customer description, the Total Sales amount, and the logo. This function is called by the
onCustGrid_Change()
function.
refreshCustomerData()
The
refreshCustomerData()
function calls the
getCustomers()
function of the customerData
service (referenced as
custService
) to retrieve the customers for the selected item in the
Category ComboBox component.
This function calls the RelayResponder constructor to establish the
onCategoryData()
function
as the function to receive the results of this call, and the
onCategoryFault()
function as the
function to receive an error or fault condition.
onCustGrid_Change()
The
onCustGrid_Change()
function is the event handler that is called when the selection in the
DataGrid component changes. This function calls the
NetDebug.trace()
function to
documents the call to this function. Then it calls the
updateDetails()
function to update the
Customer Details section.
Содержание FLASH REMOTING MX
Страница 1: ...Using Flash Remoting for Flash MX 2004 ActionScript 2 0...
Страница 8: ...8 Contents...
Страница 62: ...62 Chapter 3 Using the RemotingConnector component Flash Professional only...
Страница 142: ...142 Chapter 7 Using Flash Remoting for Java...