Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.loadFromSharedObj() | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.loadFromSharedObj(objName, [localPath])
objName A string specifying the name of the shared object to retrieve. 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; loads all of the relevant data needed to restore this DataSet collection from a shared object. To save a DataSet collection to a shared object, use DataSet.saveToSharedObj(). The DataSet.loadFromSharedObject() method overwrites any data or pending changes that might exist in this DataSet collection. Note that the instance name of the DataSet collection is used to identify the data in the specified shared object.
This method throws a DataSetError exception if the specified shared object isn't found or if there is a problem retrieving the data from it.
The following example attempts to load a shared object named webapp/customerInfo associated with the data set named my_ds. The method is called within a try...catch code block.
import mx.data.components.datasetclasses.DataSetError;
try {
my_ds.loadFromSharedObj("webapp/customerInfo");
} catch(e:DataSetError) {
trace("Unable to load shared object.");
}
Flash CS3