Adobe 65029121 - Flash Media Streaming Server Developer's Manual page 55

Developer's guide
Hide thumbs Also See for 65029121 - Flash Media Streaming Server:
Table of Contents

Advertisement

Persistent local shared objects
SharedObject.getLocal()
storage directory for the object by passing a value for the
command. By specifying a partial path for the location of a locally persistent remote shared object, you can let several
applications from the same domain access the same shared objects.
Remotely persistent shared objects
for the
true
persistence
method. These shared objects are named with the extension .fso and are stored on the server
SharedObject.get()
in a subdirectory of the application that created the shared object. Flash Media Server creates these directories
automatically; you don't have to create a directory for each instance name.
Remotely and locally persistent shared objects
the server by passing a local path for the persistence parameter in your client-side
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.
Remote shared objects
Before you create a remote shared object, create a NetConnection object and connect to the server. Once you have
the connection, use the methods in the SharedObject class to create and update the remote shared object. The
general sequence of steps for using a remote shared object is outlined below:
1
Create a NetConnection object and connect to the server:
nc = new NetConnection();
nc.connect("rtmp://localhost/SharedBall");
This is the simplest way to connect to the server. In a real application, you would add event listeners on the
NetConnection object and define event handler methods. For more information, see
2
Create the remote shared object. When the connection is successful, call
a remote shared object on the server:
so = SharedObject.getRemote("ballPosition", nc.uri, false);
The first parameter is the name of the remote shared object. The second is the URI of the application you are
connecting to and must be identical to the URI used in the
way to specify it is with the
persistent. In this case,
Connect to the remote shared object. Once the shared object is created, connect the client to the shared object
3
using the NetConnection object you just created:
so.connect(nc);
You also need to add an event listener for
so.addEventListener(SyncEvent.SYNC, syncHandler);
Synchronize the remote shared object with clients. Synchronizing the remote shared object requires two steps.
4
First, when an individual client makes a change or sets a data value, you need to update the remote shared object.
Next, update all other clients from the remote shared object.
a
To update the remote shared object when a client makes a change, use
so.setProperty("x", sharedBall.x);
To create persistent local shared objects, call the client-side
method. Persistent local shared objects have the extension .sol. You can specify a
To create remote shared objects that are persistent on the server, pass a value of
parameter in the client-side
You create remote shared objects that are persistent on the client and
property. The third parameter specifies whether the remote shared object is
nc.uri
is used to make the shared object temporary.
false
events dispatched by the shared object:
sync
parameter of the
localPath
SharedObject.getRemote()
SharedObject.getRemote()
NetConnection.connect()
setProperty()
ADOBE FLASH MEDIA SERVER
Developer Guide
SharedObject.getLocal()
method or in the server-side
SharedObject.getRemote()
SharedBall
example.
to create
method. The easiest
:
52

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash media server

Table of Contents