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. SharedObject MethodsSharedObject.close()Disconnects from a remote SharedObject. SharedObject.connect(myRTMPConnection)Connects the client to a remote SharedObject within the application instance identified in the Netconnection.
SharedObject.flush(minimumDiskSpace)Saves a copy of the internal local SharedObject to the hard disk. The client cannot invoke a flush on a remote SharedObject.
SharedObject.getLocal(objectName [, localPath])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.
SharedObject.getRemote(objectName, URI [, persistence])I nstantiates 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.
SharedObject.getSize()Returns the size value in bytes of the local or remote SharedObject. SharedObject.send(handlerName [,p1, ,pN])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.
SharedObject.setFps(updatesPerSecond)Sets the listening "frequency," in frames per second, that the client will use to monitor a SharedObject for synchronization and broadcast messages.
SharedObject PropertySharedObject.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 EventsSharedObject.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. |