Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 ユーザーズマニュアル

ページ / 156
134
Client-Side ActionScript Language Reference
To minimize network traffic, this method is not called when a client “changes” a property to 
the same value it currently has. That is, if a property is set to the same value multiple times in 
a row, this method is invoked the first time the property is set, but not during subsequent 
settings, as shown in the following example:
my_so.data.x = 15;
// The following line invokes onSync.
my_so.data.x = 20;
/* The following line doesn’t invoke onSync, 
even if issued by a different client. */
my_so.data.x = 20;
Example
The following examples creates or gets a remote shared object named 
position
:
var myRemote_so:SharedObject = SharedObject.getRemote("position", 
my_nc.uri, false);
The following updates the ball position when another participant moves the ball; 
sharedBall_mc
 is a movie clip on the Stage:
myRemote_so.onSync = function(list) {
sharedBall_mc._x= myRemote_so.data.x;
sharedBall_mc._y= myRemote_so.data.y;
}
/* You must always call connect() in order to successfully
connect to the shared object and share data. */
myRemote_so.connect(my_nc);
See also
SharedObject.send()
Availability
Flash Player 6.
Flash Communication Server MX 1.0.
Usage
myRemote_so.send(handlerName [,p1, ...,pN])