Client class
Availability
Flash Communication Server 1.
The Client class lets you handle each user, or client, connection to a Flash Media Server
application instance. The server automatically creates a Client object when a user connects to
an application; the object is destroyed when the user disconnects from the application. Users
have unique Client objects for each application to which they are connected. Thousands of
Client objects can be active at the same time.
You can use the properties of the Client class to determine the version, platform, and IP
address of each client. You can also set individual read and write permissions to various
application resources such as Stream objects and shared objects. Use the methods of the Client
class to set bandwidth limits and call methods in client-side scripts.
When you call
NetConnection.call()
that executes in the server-side script must be a method of the Client class. In your server-side
script, you must define any method you want to call from the client-side script. You can also
call any methods you define in the server-side script directly from the Client class instance in
the server-side script.
If all instances of the Client class (each client in an application) require the same methods or
properties, you can add those methods and properties to the class itself instead of adding them
to each instance of a class. This process is called extending a class. You can extend any server-
side or client-side ActionScript class. To extend a class, instead of defining methods in the
constructor function of the class or assigning them to individual instances of the class, you
assign methods to the
assign methods and properties to the
available to all instances of the class.
The following code shows how to assign methods and properties to an instance of a class. In
the
application.onConnect
side script as a parameter. You can then assign a property and method to the client instance:
application.onConnect = function(clientObj){
clientObj.birthday = myBDay;
clientObj.calculateDaysUntilBirthday = function(){
// Insert code here.
}
};
from a client-side ActionScript script, the method
property of the constructor function of the class. When you
prototype
prototype
handler
the client instance
,
property, the methods are automatically
clientObj
is passed to the server-
Client class
47
Need help?
Do you have a question about the FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE and is the answer not in the manual?