The RecordSet Class

Now that we’ve seen the ease and power of UI components, let’s see how interactivity is enhanced using one of the most impressive aspects of Flash Remoting technology: the RecordSet class. Remote method calls commonly return recordsets, which are converted to ActionScript RecordSet objects, to the Flash movie. The RecordSet class has methods that make it easy to work with data returned from a remote method and placed in a RecordSet object. For example, to find the number of records in a RecordSet object, use the getLength( ) method:

my_rs.getLength( );

To sort the items in a RecordSet object from within the Flash movie—without making another round trip to the server—you can use the sortItemsBy( ) method:

my_rs.sortItemsBy(columnName, order);

where order is asc (ascending) or desc (descending). In truth, specifying anything other than desc as the order parameter performs an ascending sort, but using asc explicitly is considered a best practice.

Other methods of the RecordSet class are just as easy to use. Here are several possibilities:

  • List or otherwise display a set of results to the user.

  • Populate a UI component, such as a ListBox or ComboBox, with the recordset data.

  • Create dynamic charts.

  • Create dynamic sortable grids.

  • Create multidimensional arrays.

A RecordSet object works seamlessly with a ColdFusion MX query object: the query object in ColdFusion is also used when addressing directories, POP email servers, and FTP servers, in addition to standard database calls. ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.