
98
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
SharedObject.setFps
Availability
• Flash Player 6.
• Flash Communication Server MX.
Usage
myRemoteSharedObject.setFps(updatesPerSecond)
Parameters
updatesPerSecond A number that specifies how often a client’s changes to a remote shared
object are sent to the server. The default value is the frame rate of the movie.
• To send changes immediately and then stop sending changes, pass 0 for updatesPerSecond.
• To res et updatesPerSecond to its default value, pass a value less than 0.
Returns
A Boolean value of true if the update was accepted, false otherwise.
Description
Method; specifies the number of times per second that a client’s changes to a shared object are
sent to the server.
Use this method when you want to control the amount of traffic between the client and the
server. For example, if the connection between the client and server is relatively slow, you may
want to set
updatesPerSecond to a relatively low value. Conversely, if the client is connected to a
multiuser game in which timing is important, you may want to set
updatesPerSecond to a
relatively high value.
If you want to manually control when updates are sent, issue this command with
updatesPerSecond set to 0 when you want to send changes to the server. For example, if you
want to let the user push a button that sends updates to the server, attach
myRemoteSharedObject.setFps(0) to the button.
Commenti su questo manuale