RecordSet.replaceItemAt( )

RecordSet.replaceItemAt( ) MethodFlash 6

replaces a row in a recordset
myRecordSet.replaceItemAt(index, record)



An integer that is between 0 and the length of the RecordSet object minus one.


An object with properties that match the fields of the existing RecordSet object.


The replaceItemAt( ) method replaces the contents of an entire row in a RecordSet object. This allows for functionality similar to the SQL update statement. Typically, you use this method to update the contents of row of data in your RecordSet object that will be reflected in a display in the Flash movie, such as in a DataGrid.


The following code shows the replaceItemAt( ) method in use, replacing the contents of one row and tracing the RecordSet object's length to the Output window:

#include ""
var myRecordset_rs = new RecordSet(["First","Last","Email"]);
var firstname = firstname_txt.text;
var lastname = lastname_txt.text;
var email = email_txt.text;
trace(myRecordSet.getLength( ));

This code creates a recordset and adds one row. Then the first row (in the 0 position) is replaced. The Output window reports that the recordset still contains only one row.

See Also

RecordSet.addItemAt( ), RecordSet.removeItemAt( ), RecordSet.setField( )

    Part III: Advanced Flash Remoting