Client-Side Communication ActionScript > SharedObject.send

 

SharedObject.send

Availability

Flash Player 6.

Flash Communication Server MX.

Usage

myRemoteSharedObject.send(handlerName [,p1, ...,pN])

Parameters

handlerName A string that identifies the message; also the name of the ActionScript handler to receive the message. The handler name can be only one level deep (that is, it can't be of the form parent/child) and is relative to the shared object.

Note: Do not use a reserved term for a handler name. For example, mySO.send("close") will fail.

p1, ...,pN Optional parameters that can be of any type. They are serialized and sent over the connection, and the receiving handler receives them in the same order. If a parameter is a circular object (for example, a linked list that is circular), the serializer handles the references correctly.

Returns

Nothing.

Description

Method; broadcasts a message to all clients connected to myRemoteSharedObject, including the client that sent the message. To process and respond to the message, create a function named handlerName attached to the shared object.

Example

The following example shows how to use send to display a message in the Output window.

// Create a remote shared object called remoteSO
// Place an Input Text text box named inputMsgTxt on the Stage
// Attach this code to a button labeled "Send Message"
on (release) {
	_root.remoteSO.send("testMsg",inputMsgTxt);
}
// Attach this code to the frame containing the button
_root.remoteSO.testMsg = function(recvStr)
{
	trace(recvStr);
}
// Type data in the text box and press the button to see the results