
Server-Side Communication ActionScript 57
The this keyword used in the body of the function is set to the shared object instance returned
by
SharedObject.get.
If you don’t want the server to receive a particular broadcast message, do not define this handler.
Example
The following example defines a handler function called broadcastMsg:
var mySO = SharedObject.get("userList", false);
mySO.broadcastMsg = function(msg1, msg2){
trace(msg1 + " : " + msg2);
};
SharedObject.lock
Availability
Flash Communication Server MX.
Usage
SharedObject.lock()
Parameters
None.
Returns
An integer indicating the lock count: 0 or greater indicates success; -1 indicates failure. For
proxied shared objects, always returns -1.
Description
Method; locks the shared object instance. This method gives the server-side script exclusive access
to the shared object; when the
SharedObject.unlock method is called, all changes are batched
and one update message is sent to all the clients subscribed to this shared object. If you nest the
SharedObject.lock and SharedObject.unlock methods, make sure there is an unlock for
every
lock; otherwise, clients are blocked from accessing the shared object.
You cannot use the SharedObject.lock method on proxied shared objects.
Example
This example locks the myShared shared object, executes the code that is to be inserted, and then
unlocks the object:
var myShared = SharedObject.get("foo");
myShared.lock();
// insert code here that operates on the shared object
myShared.unlock();
SharedObject.name
Availability
Flash Communication Server MX.
Usage
SharedObject.name
Description
Property (read-only); the name of a shared object.
Commenti su questo manuale