SharedObject class
125
Example
The following example creates a shared object named
foo
in the function
onProcessCmd
. The
function is passed a parameter,
cmd
, that is assigned to a property in the shared object.
function onProcessCmd(cmd){
// Insert code here.
var shObj = SharedObject.get("foo", true);
propName = cmd.name;
shObj.getProperty (propName, cmd.newAddress);
}
The following example uses a proxied shared object. A proxied shared object resides on a
server or in an application instance (called
master
) that is different than the server or
application instance that the client connects to (called
proxy
). When the client connects to the
proxy and gets a remote shared object, the proxy connects to the master and gives the client a
reference to this shared object. The following code is in the main.asc file:
application.appStart = function() {
nc = new NetConnection();
nc.connect("rtmp://" + master_ "/" + master_instance);
proxySO = SharedObject.get("myProxy",true,nc);
// Now, whenever the client asks for a persistent
// shared object called myProxy they will receive myProxy
// shared object from the master_server/master_instance.
};
SharedObject.getProperty()
Availability
Flash Communication Server MX 1.0.
Usage
mySO
.getProperty(
name
)
Parameters
name
The name of the property in the shared object.
Returns
The value of a SharedObject property.
Description
Method; retrieves the value of a named property in a shared object. The returned value is a
copy associated with the property, and any changes made to the returned value do not update
the shared object. To update a property, use the
SharedObject.setProperty()
method.
Содержание FLASH MEDIA SERVER 2
Страница 1: ...Server Side ActionScript Language Reference...
Страница 4: ...4 Contents...
Страница 228: ...228 Server Side ActionScript Language Reference...
Страница 234: ...234 Server Side Information Objects...