
142
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
Note: Changing or deleting a property on the server side by using the SharedObject.setProperty() method always
succeeds, so there is no notification of these changes.
The following table describes the codes for local shared objects:
Note: The SharedObject.onSync() handler is invoked when a shared object has been successfully synchronized with
the server. If there is no change in the shared object, the list object may be empty.
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 or unsuccessfully changed properties
// from the last time onSync() was called.
so.onSync = function(list) {
for (var i = 0; i < list.length; i++) {
switch (list[i].code ) {
case "success":
trace ("success");
break;
case "change":
trace ("change");
break;
case "reject":
trace ("reject");
break;
case "delete":
trace ("delete");
break;
case "clear":
trace ("clear");
break;
}
}
};
Proxied code Meaning
success A server change of the shared object was accepted.
reject A server change of the shared object was rejected. The value on the remote instance was not changed.
change A property was changed by another subscriber.
delete A property was deleted. This notification can occur when a server deletes a shared object or if another
subscriber deletes a property.
clear All the properties of a shared object are deleted. This can happen when the server’s shared object is out of sync
with the master shared object or when the persistent shared object migrates from one instance to another.
This event is typically followed by a
change message to restore all of the server’s shared object properties.
name The name of a property that has changed or been deleted.
oldValue The old value of the property. This is valid only for the reject, change, and delete codes.
Komentáře k této Příručce