User Guide
Table Of Contents
- Contents
- About Flash Remoting
- Getting Started
- Using Flash Remoting ActionScript
- Using the RemotingConnector component (Flash Professional only)
- Using Flash Remoting Data in ActionScript
- About Flash Remoting and data types
- Understanding Action Message Format
- Converting from ActionScript to application server data types
- Converting from application server data types to ActionScript
- ColdFusion to ActionScript data conversion issues
- About working with objects
- About working with RecordSet objects
- About working with XML
- The NetConnection Debugger
- Using Flash Remoting with ColdFusion MX
- Using Flash Remoting for Java
- About Flash Remoting for Java
- Calling Java classes or JavaBeans from ActionScript
- Calling Enterprise JavaBeans (EJBs) from Flash
- Calling servlets and JSPs from Flash
- Calling JMX MBeans from Flash (JRun only)
- Calling server-side ActionScript from Flash (JRun only)
- Handling function results in ActionScript
- Using Flash Remoting with JRun security
- Passing XML objects between Flash and Java
- Viewing Flash Remoting log entries
- Using Flash Remoting for Microsoft .NET
- Flash Remoting for Microsoft .NET
- Calling ASP.NET pages from Flash
- Making an ASP.NET page available to Flash Remoting
- Getting a reference to an ASPX-based service in ActionScript
- Invoking ASPX pages in ActionScript
- Using the Flash Remoting custom server control in ASPX pages
- Using the Flash Remoting namespace in code-behind files
- Using ASP.NET state management with Flash Remoting
- Using ASP.NET exception handling
- Using ADO.NET objects with Flash Remoting
- Displaying a RecordSet object in Flash with ActionScript
- Calling web services from Flash
- Calling ASP.NET assemblies from Flash
- Viewing Flash Remoting log entries
- Using NetServices and Connection Classes
- Index

78 Chapter 4: Using Flash Remoting Data in ActionScript
Adding records to the RecordSet object
To add items to a RecordSet object, use the addItem() or addItemAt() methods. The
addItem() method adds a record at the end of the record set. The addItemAt() method inserts a
record at the specific index location; the indexes of all the other records in the RecordSet object
are automatically incremented by one. For example, the following adds a single record at the
beginning of the myRecordSet object:
var newRecord = {DepartmentID: "BA1EA7FF0-7D79-32D3-A9280050042189548",
DepartmentName: "Technical Publications"};
myRecordSet.addItemAt(0, newRecord);
Removing records from the RecordSet object
To remove records from a RecordSet object, use the removeItemAt(), removeAll(), and
clear() methods. The removeItemAt() method removes a record at a specific index location,
and the
removeAll() and clear() methods remove all records from the RecordSet object. For
example, the following line removes the record at the first index location (0). The indexes of all
the other records in the RecordSet object are automatically decremented by one:
theRecordSet.removeItemAt(0);
Replacing and renaming records in the RecordSet object
To replace a record in a RecordSet object, you use the replaceItemAt() method. To replace a
specific field in a record in a RecordSet object, use the
editField() method. For example, the
following code replaces the contents of the third record in
theRecordSet RecordSet object with
the contents of the
newRecord variable. It then replaces the contents of the third record’s
DepartmentName field:
var newRecord = {DepartmentID: "BA1EA720-7D79-11D3-A9280050042189548",
DepartmentName: "Complaints"};
theRecordSet.replaceItemAt(2, newRecord);
theRecordSet.editField(2,"DepartmentName","Compliments");
Using notifications with RecordSet objects
You can notify any ActionScript object of changes in a RecordSet object’s internal state. For
example, if you associate a RecordSet object with a ListBox component, and the record set gets
sorted into a different order, Flash can notify the ListBox component that the record order
changed, so the ListBox component can redraw itself according to the new order.
Similarly, a RecordSet object can notify its associated ListBox component when all records arrive
from the server. Then, if required, the ListBox can redraw itself to update its display.
Note: Flash UI components such as ListBox incorporate notifications as a standard part of their use
of the RecordSet ActionScript class. The
addEventListener() method is only necessary if you need
to receive notifications in your own ActionScript code, for example, if you create your own UI
component.