Hi gurus,
I am working on a private chat(One to One) just like a messenger.
I am using tutorial_text (sample) as base.
Is there any code available for the private chat. Please help gurus..
The Main.asc file is as show below... What should be in the client ?
ActionScript Code:
application.onAppStart = function()
{
trace("Begin sharing text");
// Get the server shared object users_so
application.users_so = SharedObject.get("users_so", false);
// Initialize the history of the text share
application.history = "";
// Initialize the unique user ID
application.nextId = 0;
}
//application.onConnect = function(newClient, name)
application.onConnect = function(newClient, name)
{
// Make this new client's name the user's name
newClient.name = name;
// Create a unique ID for this user while incrementing the
// application.nextID.
newClient.id = "u" + application.nextId++;
// Update the users_so shared object with the user's name
application.users_so.setProperty(newClient.name, name);
// Accept the client's connection
application.acceptConnection(newClient);
// Call the client function setHistory, and pass
// the initial history
newClient.call("setHistory", null, application.history);
// The client will call this function to get the server
// to accept the message, add the user's name to it, and
// send it back out to all connected clients.
newClient.msgFromClient = function(msg) {
application.users_so.send("msgFromSrvr", msg);
}
}
application.onDisconnect = function(client)
{
trace("disconnect: " + client.name);
application.users_so.setProperty(client.name, null);
}