RecordSet.replaceItemAt( ) Method | Flash 6 |
replaces a row in a recordset |
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 "RecordSet.as" var myRecordset_rs = new RecordSet(["First","Last","Email"]); myRecordset_rs.addItem({First:"",Last:"",Email:""}); var firstname = firstname_txt.text; var lastname = lastname_txt.text; var email = email_txt.text; myRecordset_rs.replaceItemAt(0,{First:firstname,Last:lastname,Email:email}); 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.
RecordSet.addItemAt( ), RecordSet.removeItemAt( ), RecordSet.setField( )