Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.readOnly | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.readOnly
Property; a Boolean value that specifies whether this collection can be modified (false) or is read-only (true). Setting this property to true prevents updates to the collection. The default value is false.
You can also set this property in the Property inspector.
The following example makes the DataSet object named my_ds read-only, and then attempts to change the value of a property that belongs to the current item in the collection. This attempt throws a DataSetError exception.
import mx.data.components.datasetclasses.DataSetError;
my_ds.readOnly = true;
try {
// This throws an exception.
my_ds.addItem({name:'Joe'});
} catch (e:DataSetError) {
// Sort specified 'name' doesn't exist for DataSet 'my_ds'.
trace("DataSetError >> " + e.message);
}
Flash CS3