MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 82

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 81
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
79
Availability
Flash Media Interactive Server 3 and Flash Media Development Server 3
SharedObject class
The SharedObject class lets you store data on the server and share data between multiple client applications in real
time. Shared objects can be temporary, or they can persist on the server after an application has closed; you can
consider shared objects as real-time data transfer devices.
Note: This entry explains the server-side SharedObject class. You can also create shared objects with the client-side
SharedObject class.
The following list describes common ways to use shared objects in Server-Side ActionScript:
1 Storing and sharing data on a server. A shared object can store data on the server for other clients to retrieve. For
example, you can open a remote shared object, such as a phone list, that is persistent on the server. Whenever a client
makes a change to the shared object, the revised data is available to all clients that are currently connected to the
object or that connect to it later. If the object is also persistent locally and a client changes the data while not
connected to the server, the changes are copied to the remote shared object the next time the client connects to the
object.
2 Sharing data in real time. A shared object can share data among multiple clients in real time. For example, you
can open a remote shared object that stores real-time data that is visible to all clients connected to the object, such
as a list of users connected to a chat room. When a user enters or leaves the chat room, the object is updated and all
clients that are connected to the object see the revised list of chat-room users.
It is important to understand the following information about using shared objects in Server-Side ActionScript:
The Server-Side ActionScript method SharedObject.get() creates remote shared objects; there is no server-
side method that creates local shared objects. Local shared objects are stored in memory, unless they’re persistent, in
which case they are stored in .sol files.
Remote shared objects that are stored on the server have the file extension .fso and are stored in a subdirectory
of the application that created them. Remote shared objects on the client have the file extension .sor and are also
stored in a subdirectory of the application that created them.
Server-side shared objects can be nonpersistent (that is, they exist for the duration of an application instance) or
persistent (that is, they are stored on the server after an application closes).
To create a persistent shared object, set the persistence parameter of the SharedObject.get() method to
true. Persistent shared objects let you maintain an applications state.
3 Every remote shared object is identified by a unique name and contains a list of name-value pairs, called
properties, like any other ActionScript object. A name must be a unique string and a value can be any ActionScript
data type.
Note: Unlike client-side shared objects, server-side shared objects do not have a
data property.
To get the value of a server-side shared object property, call SharedObject.getProperty(). To set the value of
a server-side shared object property, call
SharedObject.setProperty().
To clear a shared object, call the SharedObject.clear()method; to delete multiple shared objects, call the
application.clearSharedObjects() method.
Vedere la pagina 81
1 2 ... 77 78 79 80 81 82 83 84 85 86 87 ... 154 155

Commenti su questo manuale

Nessun commento