Server-Side Communication ActionScript > SharedObject.send

 

SharedObject.send

Availability

Flash Communication Server MX.

Usage

SharedObject.send(methodName, [p1, ..., pN])

Parameters

methodName The name of a method on a client shared object instance. 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 ActionScript type, including references to other ActionScript objects. These parameters are passed to the specified methodName when it executes on the Flash client.

Returns

A Boolean value of true if the message was sent to the client; false otherwise.

Description

Method; 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.

Example

This example calls the SharedObject.send method to execute the doSomething method in the client-side ActionScript and passes doSomething the string "this is a test".

var myShared = SharedObject.get("foo", true);
myShared.send("doSomething", "this is a test");

The following example is the client-side ActionScript code that defines the doSomething method:

connection = new NetConnection();
connection.connect("rtmp://www.macromedia.com/someApp");
var x = SharedObject.getRemote("foo", connection.uri, true);
x.connect(connection); 
x.doSomething = function(str) {
// process the str
};