User Guide
128 Client-Side ActionScript Language Reference
persistence An optional value that specifies whether the attributes of the shared object’s
data property are persistent locally, remotely, or both, and that may specify where the shared
object will be stored locally. Acceptable values are as follows:
■ null (default) or false specifies that the shared object is not persistent on the client or
server. (These values have the same effect as omitting the
persistence parameter.)
■ true specifies that the shared object is persistent only on the server.
■ A full or partial local path to the shared object indicates that the shared object is persistent
on the client and the server; on the client, it is stored in the specified path. On the server,
it is stored in a subdirectory within the Flash Media Server applications directory. For
more information, see the Description.
Returns
A reference to an object that can be shared across multiple clients. If Flash can’t create or find
the shared object (for example, if a local path was specified for
persistence but no such
directory exists), this method returns
null.
Description
Method; returns a reference to an object that can be shared across multiple clients by means of
the Flash Media Server. To create a shared object that is available only to the current client,
use
SharedObject.getLocal().
After issuing this command, use
SharedObject.connect() to connect the object to the
Flash Media Server, as follows:
var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://somedomain.com/applicationName");
var myRemote_so = SharedObject.getRemote("mo", my_nc.uri, false);
myRemote_so.connect(my_nc);
To confirm that the local and remote copies of the shared object are in sync, use the
SharedObject.onSync event handler.
All clients that want to share this object must pass the same values for objectName and URI.
Understanding persistence for remote shared objects By default, the shared object is not
persistent on the client or server; that is, when all clients close their connections to the shared
object, it is deleted. To create a shared object that is saved locally or on the server, pass a value
for
persistence.
NOTE
If the user has chosen to never allow local storage for this domain, the object will not
be saved locally, even if a local path is specified for
persistence. For more
information, see “Local disk space considerations” on page 115.