136
Client-Side ActionScript Language Reference
SharedObject.setFps()
Availability
■
Flash Player 6.
■
Flash Communication Server MX 1.0.
Usage
myRemote_so
.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 SWF file.
■
To send changes immediately and then stop sending changes, pass 0 for
updatesPerSecond
.
■
To reset
updatesPerSecond
to its default value, pass a value less than 0.
Returns
A Boolean value of
true
if the update was accepted; otherwise,
false
.
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.
Regardless of the value you pass for
updatesPerSecond
, changes are not sent to the server
until
SharedObject.onSync
has returned a value for the previous update. That is, if the
response time from the server is slow, updates may be sent to the server less frequently than
the value specified in
updatesPerSecond
.
See also
SharedObject.onSync