
Application Development Tips and Tricks 69
Persistent local shared objects
You create persistent local shared objects by using the client-side
SharedObject.getLocal
command. Persistent local shared objects have the extension .sol and are stored on the client
machine in a directory associated with the user who created the shared object. On Windows, the
default location is C:\Documents and Settings\userName\Application Data\Macromedia\Flash
Player\serverSubdomain\pathToMovie\movieName.swf. (You can override the default by passing a
value for the
localPath parameter of the SharedObject.getLocal command.)
For example, if your logon ID is jsmith, you are running your server on a local machine
(localhost), your movie is named myMovie.swf and is located in the C:\test directory, a local
shared object created by the code below would be stored in the following location: C:\Documents
and Settings\jsmith\Application Data\Macromedia\Flash
Player\localhost\test\myMovie.swf.\myObject.sol.
my_so = SharedObject.getLocal("myObject");
Remotely persistent shared objects
You create remote shared objects that are persistent only on the server by passing a value of true
for the
persistence parameter in the client-side SharedObject.getRemote command or in the
server-side
SharedObject.get command. These shared objects are named with the extension
.fso, and are stored on the server in a subdirectory of the application that created the shared
object. The Flash Communication Server creates these directories automatically; you don’t have
to create a directory for each instance name. On Windows, the default location is C:\Program
Files\Macromedia\Flash Communication Server
MX\flashcom\applications\appName\sharedobjects\instanceName.
For example, a remote shared object created by the code below would be stored in the following
location: ..\flashcom\applications\myWhiteboard\sharedobjects\monday\myObject.fso.
my_nc = new NetConnection();
my_nc.connect("rtmp://myFlashServer.myDomain.com/myWhiteboard/monday");
// The third parameter of "true" specifies that the object
// should persist on the server.
my_so.getRemote("myObject", my_nc.uri, true);
my_so.connect(my_nc);
Remotely and locally persistent shared objects
You create remote shared objects that are persistent on the client and the server by passing a local
path for the
persistence parameter in your client-side SharedObject.getRemote command.
The locally persistent shared object is named with the extension .sor and is stored on the client in
the specified path. The remotely persistent .fso file is stored on the server in a subdirectory of the
application that created the shared object (see “Remotely persistent shared objects” above).
By specifying a partial path for the location of a locally persistent remote shared object, you can
let several movies from the same domain access the same shared objects. For more information,
see
SharedObject.getRemote in the Client-Side Communication ActionScript Dictionary.
Commenti su questo manuale