
144
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
so = SharedObject.get("foo");
so.resyncDepth = 10;
SharedObject.send()
so.send(methodName, [p1, ..., pN])
Executes a method in a client-side script. You can use SharedObject.send() to asynchronously execute a method on
all the Flash clients subscribing to a shared object. The server does not receive any notification from the client on the
success, failure, or return value in response to this message.
Availability
Flash Communication Server 1
Parameters
methodName A string indicating the name of a method on a client-side shared object. For example, if you specify
"
doSomething", the client must invoke the SharedObject.doSomething() method, with all the p1, ..., pN
parameters.
p1, ..., pN Parameters of any type, including references to other objects. These parameters are passed to the
specified
methodName on the client.
Returns
A boolean value of true if the message was sent to the client; otherwise, false.
Example
The following example calls the SharedObject.send() method to invoke the doSomething() method on the client
and passes the string
"This is a test":
var so = SharedObject.get("foo", true);
so.send("doSomething", "This is a test");
The following example is the client-side ActionScript code that defines the doSomething() method:
nc = new NetConnection();
nc.connect("rtmp://www.adobe.com/someApp");
var so = SharedObject.getRemote("foo", nc.uri, true);
so.connect(nc);
so.doSomething = function(str) {
// Process the str object.
};
SharedObject.setProperty()
so.setProperty(name, value)
Updates the value of a property in a shared object.
The name parameter on the server side is the same as an attribute of the data property on the client side. For example,
the following two lines of code are equivalent; the first line is Server-Side ActionScript and the second is client-side
ActionScript:
so.setProperty(nameVal, "foo");
clientSO.data[nameVal] = "foo";
Commenti su questo manuale