82
Chapter 4: Using Flash Remoting Data in ActionScript
Flash Remoting can deliver pageable record set data to your application in three modes, as
described in the following table:
You change a RecordSet object’s delivery mode by calling the
setDeliveryMode()
method, as in
the following example:
function getCustomerData_Result( dataEvent:mx.rpc.ResultEvent ):Void {
if (config_panel.deliveryMode.getData() == "page")
{
theRecordSet.setDeliveryMode("page", contact_grid.getRowCount(), 1);
}
else if (config_panel.deliveryMode.getData() == "fetchAll")
{
theRecordSet.setDeliveryMode("fetchAll", 10);
}
else
{
theRecordSet.setDeliveryMode("onDemand");
}
}
In this example, theRecordSet object represents the record set returned from Flash Remoting, and
the
config_panel
object represents a Flash movie clip. Using the
deliveryMode.getData()
method, the code evaluates the delivery mode specified by
config_panel
, and uses the
setDeliveryMode()
method to set the mode of delivery for the RecordSet object.
Data delivery
modes
Description
ondemand
(default)
When you access a particular record using the
getItemAt()
method, the
RecordSet object requests the record from the server-side Flash Remoting
RecordSet service.
page
When you use the
getItemAt()
method to access a record, the RecordSet object
fetches data one or more pages at a time.
You specify the number of records per page when you set the delivery mode. The
default page size is 25 records.
You can also tell Flash Remoting to get, or prefetch, a number of pages of data
that follow the page that contains the requested data. Flash Remoting stores
these additional pages in the client if it has not already fetched them in a previous
request. The default prefetch value is 0 (only get the page with the requested
data).
For example, if you specify a page size of 15 records and a number of pages to
prefetch of 3, Flash Remoting automatically fetches 45 records when you make
your first request for a record in the data set. If you then request a record on the
second page that was returned, Flash Remoting prefetches an additional 15
records.
fetchall
As a background activity, the RecordSet object fetches the entire contents of the
record set from the server, starting when the service function that retrieves the
record set on the application server returns.
You can specify a page size when you set the delivery mode to
fetchall
. Flash
Remoting continues requesting one page at a time from the server until all pages
have been returned. The default page size is 25 records.
Содержание FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT...
Страница 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...