5

Setting up a namespace on the Client object on the Flash Communication Server

 3 years ago
source link: http://www.mikechambers.com/blog/2002/08/02/setting-up-a-namespace-on-the-client-object-on-the-flash-communication-server/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Setting up a namespace on the Client object on the Flash Communication Server

Friday, August 2, 2002

I have been writing some Flash Communication Server code (on the server side), and had a need to connect methods and properties to the Client object. Normally, I would use _resolve so i would not have to attach methods directly to the Client object, but doing that would mean that my code could not work with the Flash Communication Server components, which also define _resolve.

The solution, was to create a namespace on the Client object and store my data there.

Client.prototype.MyNameSpace = new Object();

Client.prototype.MyNameSpace.foo = function()
{
	trace("foo");
}

When calling the method from Flash, just remember to insert the namespace:

nc.call("MyNameSpace.foo", null);

While this is not the best solution (_resolve is), is does help ensure that you will not have namespace collisions with other server side code that may attach properties or functions to the Client object.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK