Remote SharedObject 101: Take one|”sharedball”

* The position of the sharedball can be updated by client or by other clients.
When the client updates the sharedball position, simply render and display the ball. The client also needs
to update the Model (RSO) and the Model will broadcast all the changes via “onSync” events to other clients that is connected to the Model;
The updates from other clients are accomplished by RSO “onSync” handler.

var sharedBall_mc;
var nc = new NetConnection();
var rso;

nc.onStatus = function(info){
case “NetConnection.Connect.Success”:
rso = SharedObject.getRemote(“position”, nc.uri);
rso.onSync = function(list){
for(var i in list){
var info = list[i];

sharedBall_mc.onPress = function(){
this.onMouseMove = function(){
sharedBall_mc.onRelease = sharedBall_mc.onReleaseOutside= function(){
delete this.onMouseMove;
function updateModelBy(mc){ = mc._x; = mc._y;

function updateMC(){
sharedBall_mc._x =;
sharedBall_mc._y =;

nc.connect(“rtmp:/tutorial_sharedball”, false);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: