Create Remote Shared Object on Flash Media Server 2
trace("start");
// Create the shared object to store client objects (users)
this.users_so = SharedObject.get("users_so", false);
Subscribe Remote Shared Object on client
users_so = SharedObject.getRemote("users_so", nc.uri, false);
users_so.addEventListener(SyncEvent.SYNC, usersSync);
users_so.addEventListener(NetStatusEvent.NET_STATUS, onSOnetStatus); //Old 'onStatus()'
users_so.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSOSecurityError);
//SharedObject has a property 'client' that defines obj on which will invoked remote methods
users_so.client = this;
users_so.connect(nc);
Send a function (on client)
var outmsg:String = "Hello World!!";
//Broadcasts a message to all clients connected to the specified remote shared object
chat_so.send("onMsgSend", outmsg);
}
Execute a function (on client) earlier sended
trace("onMsgSend: " + msg);
chatHistory += msg;
dispatchEvent(new Event("histChange"));
}