The SharedObject is a programming model that allows you to share data between communication clients or save data on a client computer in a cookie type fashion. SharedObjects on the client can be remote or local. Remote SharedObjects can be temporary or persistent. If they are temporary, they are destroyed when the last client or the server has disconnected from it. 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.
To use the local SharedObject:
my_so = SharedObject.getLocal("SOname");
To use the remote SharedObject:
my_so = SharedObject.getRemote("SOname"); my_so.connect(nc);
To enable Code Hints and Code Completion in the Flash MX ActionScript Editor, use the suffix _so in the name of the SharedObject variable.
Disconnects from a remote SharedObject.
Connects the client to a remote SharedObject within the application instance identified in the Netconnection.
|myRTMPConnection||The name of a connected NetConnection object.|
Saves a copy of the internal local SharedObject to the hard disk. The client cannot invoke a flush on a remote SharedObject.
|minimumDiskSpace||The value in bytes to reserve in the local SharedObject disk version. Default value is 0.|
Instantiates the local SharedObject to an internal variable and returns a reference to a locally persistent SharedObject that is available only to the current client.
|objectName||The name of the local SharedObject to connect to.|
|localPath||The folder name of the SharedObject is stored on the client's hard disk.|
Instantiates the SharedObject to a local variable and sets the SharedObject name to connect to or create. This method must be followed by a SharedObject.connect() event to connect to the remote SharedObject.
|objectName||The name of the SharedObject.|
|URI||The URI of a communication server storing the SharedObject.|
|persistence||A Boolean value; true indicates that the SharedObject is persistent.|
Returns the size value in bytes of the local or remote SharedObject.
Sends a message to all subscribed clients of the SharedObject. This call invokes a function defined by the client or server in the SharedObject Instance object.
|handlerName||The name of the handler function to call.|
|p1, ...,pN||Any parameters required by the handler function.|
Sets the listening "frequency," in frames per second, that the client will use to monitor a SharedObject for synchronization and broadcast messages.
|updatesPerSecond||A value, in frames per second, the client will probe the server for messages.|
SharedObject.data the collection of slots or properties stored within the SharedObject. This property cannot be populated with a value; it accepts valid ActionScript variable types only.
SharedObject.onStatus handles status changes of the SharedObject. Status changes contain Information objects with code and level properties.
For a complete list of values, refer to the Appendix C,which lists all Information objects.
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.