Custom Search

Shared Objects inside Adobe Flash Media Server

Shared Objects can be said as cookie for Flash Environment. Shared Objects are responsible for storing temporary information which can be accessible to the whole flash application. In Flash Media Server Environment, shared objects can be useful for making Chat or MultiPlayer Games Application. This article will show how we can make and store data inside Shared Objects using Adobe Flash Media Server.





Your email:  
Subscribe Unsubscribe  

application.onAppStart = function() {
	this.sharedobj = SharedObject.get("sharedobj", true);
}
 
application.onConnect = function(client,username) {
	username = "Hitesh";
	trace("Client connected with username: " + username);
	client.username = username;
	// accept the connection. NOTE: normally you should add some security and/or authentication here.
	this.acceptConnection(client);
	// add the user to the SharedObject, this will trigger an onSync on all connected clients
	this.sharedobj.setProperty("Username", username);
}	
 
// invoked whenever a client disconnects
application.onDisconnect = function(client) {
	trace("Client disconnected.");
	// remove the client from the SharedOject
	this.chat_so.setProperty(client.username, null);
}

Code Explanation:

Your email:  
Subscribe Unsubscribe  

Similar Posts

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)