Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.saveToSharedObj() | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.saveToSharedObj(objName, [localPath])
objName A string that specifies the name of the shared object to create. The name can include forward slashes (for example, "work/addresses"). Spaces and the following characters are not allowed in the specified name:
~ % & \ ; : " ' , < > ? #
localPath An optional string parameter that specifies the full or partial path to the SWF file that created the shared object. This string is used to determine where the object is stored on the user's computer. The default value is the SWF file's full path.
Nothing.
Method; saves all of the relevant data needed to restore this DataSet collection to a shared object. This allows users to work when disconnected from the source data, if it is a network resource. This method overwrites any data that might exist within the specified shared object for this DataSet collection. To restore a DataSet collection from a shared object, use DataSet.loadFromSharedObj(). Note that the instance name of the DataSet collection is used to identify the data within the specified shared object.
If the shared object can't be created or there is a problem flushing the data to it, this method throws a DataSetError exception.
The following example calls saveToSharedObj() in a try..catch block and displays an error if there is a problem saving the data to the shared object.
import mx.data.components.datasetclasses.DataSetError;
try {
my_ds.saveToSharedObj("webapp/customerInfo");
} catch(e:DataSetError) {
trace("Unable to create shared object");
}
Flash CS3