
Server-Side Communication ActionScript 73
Example
This example opens a stream s and, when it is open, plays sample and records it. Because no
value is passed to the
record method, the default value, record, is passed.
// To start recording
s = Stream.get("foo");
if (s){
s.play("sample");
s.record();
}
// To stop recording
s = Stream.get("foo");
if (s){
s.record(false);
}
Stream.send
Availability
Flash Communication Server MX.
Usage
Stream.send(handlerName, [p1, ..., pN])
Parameters
handlerName Calls the specified handler in client-side ActionScript code. The handlerName
value is the name of a method relative to the subscribing Stream object. For example, if
handlerName is doSomething, the doSomething method at the stream level is invoked with all
the
p1, ..., pN parameters. Unlike the method names in Client.call and
NetConnection.call, the handler name can be only one level deep (that is, it cannot be of the
form
object/method).
Note: Do not use a built-in method name for a handler name. For example, the subscribing stream will be closed if
the handler name is close.
p1, ..., pN Parameters of any ActionScript type, including references to other ActionScript
objects. These parameters are passed to the specified handler when it is executed on the Flash
client.
Returns
A Boolean value of true if the message was sent to the client, false otherwise.
Description
Method; sends a message to all clients subscribing to the stream and the message is processed by
the handler specified on the client. Because the server has higher priority than the clients, the
server can still send a message on a stream owned by a client. Unlike the
Stream.play() method,
the server does not need to take ownership of a stream from the client in order to send a message.
After
send() is called, the client still owns the stream as a publisher.
Example
This example calls the method Test on the client-side Stream object and sends it the string
"hello world":
application.streams["foo"].send("Test", "hello world");
Commentaires sur ces manuels