SharedObject Object

The SharedObject is a programming model that allows you to share data between Communication Server clients. SharedObjects can be temporary or persistent. If they are temporary, they are destroyed when the last client or the server has disconnected from the application. SharedObjects send synchronization messages to all connections notifying of change. These objects can be created by the server or by a client, based on the Client permissions. This object can be used by the server to maintain a SharedObject or connect to a Remote SharedObject existing on another server.

To enable Code Hints and Code Completion in Macromedia Dreamweaver MX, use the suffix _so in the name of the SharedObject variable.

SharedObject Methods

The SSAS SharedObject methods are described next:


Removes all data slots from a persistent SharedObject and returns a "clear" code to all clients subscribed.


Deletes the SharedObject instance, or unsubscribes a SharedObject. The server no longer receives onSync events, but clients that are still subscribed to it still have access.


Forces an internal "memory" version of a persistent SharedObject to the hard disk. This method is also invoked when all connections to the SharedObject are closed, or the instance is unloaded.

SharedObject.get(name, boolPersist [, netConnection])

Use this function to instantiate the SharedObject and determine the SharedObject to connect to or create. This function can also set up a proxied SharedObject through a NetConnection.

name The name of the new SharedObject instance.
boolPersist A Boolean value: A value of "true" accesses or creates a persistent SharedObject; false accesses a temporary SharedObject.
netConnection The connection to a remote server to proxy a remote SharedObject.


Returns the value of a SharedObject slot. This is achieved on the client by accessing the data property.

name The name of the data property or slot to return.


Returns an array of property names slotted to the SharedObject.


Restricts clients from writing to a SharedObject and suppresses any onSync notifications. OnSync notifications are batched until the object is unlocked.


A cleanup tool that removes all deleted properties that are older than the version declared in the parameter.

version A SharedObject version number.

SharedObject.send(methodName, [p1, …, pN])

Calls a method defined on the client in the SharedObject instance.

methodName The name of the client method to call.
p1, ..., pN Custom parameters sent by the client to this server method.

SharedObject.setProperty(name, value)

Set the value of an existing or new SharedObject property.

name The target property name.
value A new ActionScript variable. It can include objects, arrays, or any other valid ActionScript type.


Returns an integer value of the total properties active within a SharedObject.


Releases a SharedObject lock. When this method is called, all changes that occurred during the lock are sent to all subscribed clients.

SharedObject Properties returns the name of the current SharedObject.

SharedObject.resyncDepth sets an integer value to indicate when deleted properties of a SharedObject are purged.

SharedObject.version returns the active version number of the SharedObject.

SharedObject Events

SharedObject."commandName"([p1, ..., pN]) SSAS methods can be set within a SharedObject instance to handle broadcast messages sent from subscribed clients using the .send method.

p1, ..., pN Custom parameters sent to the client function.

SharedObject.onStatus is used to handle status changes of the SharedObject. Status changes contain information objects with code and level properties. For a complete list of values, refer to Appendix D,"Flash UI Components Quick Reference," for a list of all Information Objects related to the SharedObject.

SharedObject.onsync is invoked on every subscriber to the SharedObject when SharedObject properties change. The event returns an array of objects containing information on any changes to a SharedObject property.

    Part I: 10 Quick Steps for Getting Started