52
Chapter 2: Using Flash Remoting ActionScript
The
onReveal()
function calls the
addEventListener()
function to establish this function as
the event handler for the
customers_grd
DataGrid component
.
onCustCat_Change()
The
onCustCat_Change()
function is the event handler that is called when the selection in the
Category ComboBox component changes. It calls the
refreshCustomerData()
function to
retrieve the customers for the selected category.
The
onCategoryData()
function calls the
addEventListener()
function to register this
function as the event handler for the
cust_Cat_cmbo
ComboBox component.
onCategoryData()
The
onCategoryData()
function handles the result of a call to the
custService.
getCategories()
function. The
CustomerInfoFormAPI()
function named this function as the
result handler for the
getCategories()
function.
This function first calls the
NetDebug.trace()
function to document the call to this function.
Then it calls the
DataGlue.bindFormatStrings()
function to make the
Name
field the label that
appears in the ComboBox component and make the ID field the data field for the record. The
call to
addEventListener()
makes the
onCustCat_Change()
function the event handler when a
change occurs to the selection in the
custCat_cmbo
ComboBox component. This function calls
the
refreshCustomerData()
function to display the customers in the current category.
onCustomerData()
The
onCustomerData()
function handles the results of the call to the
custService.
getCustomers()
function in the
refreshCustomer()
function. This function assigns the result
of the call to the
getCustomers()
function to the
rs
record set. It sets the delivery mode to
onDemand
, which means that the server will deliver records for this record set in groups of up to
25 records for each call to the
getCustomers()
function. Next, this function loads the length of
the returned record set into
totalRec_txt.text
variable for display in the Total field of the user
interface. Then it sets
customers_grd.dataProvider
to
rs
to specify that
rs
provides the data
for the grid. Finally, it calls the
updateDetails()
function to update the Customer Details
section for the selected customer.
onCustomerFault()
The
onCustomerDataFault()
function handles the fault outcome of a request for customer data.
It calls
Alert()
to notify the user of the problem and then calls the
NetDebug.trace()
function
to display a message and report the status as specified by the
faultstring
property of the Fault
object that is passed to the function in a FaultEvent object.
onCategoryFault()
The
onCategoryDataFault()
function handles the fault outcome of a request for Category data.
It calls
Alert()
to notify the user of the problem and then calls the
NetDebug.trace()
function
to display a message and report the status as specified by the
faultstring
property of the Fault
object that is passed to the function in a FaultEvent object.