
52
Example
The following example creates a function that is invoked whenever a property of the shared object
so changes:
// create a new NetConnection object
nc = new NetConnection();
nc.connect("rtmp://server1.xyx.com/myApp");
// create the shared object
so = SharedObject.get("MasterUserList", true, nc);
// the list parameter is an array of objects containing information
// about successfully of unsuccessfully changed properties
// from the last time onSync() was called
so.onSync = function(list) {
for (var i = 0; i < list.length; i++) {
if (list[i].code == "success") {
// deal with the success case
} else if (list[i].code == "change"){
// deal with the "change"
} else if (list[i].code == "reject"){
// deal with the "reject"
} else if (list[i].code == "delete"){
// deal with the "delete"
} else if (list[i].code == "clear"){
// deal with the "clear"
}
}
}
SharedObject.purge
Availability
Flash Communication Server MX.
Usage
SharedObject.purge(version)
Parameters
version A version number. All deleted data that is older than this version is removed.
Returns
Nothing.
Description
Method; causes the server to purge all deleted properties that are older than the specified version.
Although you can also accomplish this task by setting the
SharedObject.resyncDepth property,
the
SharedObject.purge method gives the script more control over which properties to delete.
Example
This example deletes all properties of the myShared shared object that are older than the value of
SharedObject.version - 3.
var myShared = SharedObject.get("foo", true);
myShared.lock();
myShared.purge(myShared.version - 3);
myShared.unlock();
Komentarze do niniejszej Instrukcji