Server-Side Communication ActionScript > Application.clients |
Application.clients
Availability
Flash Communication Server MX.
Usage
application.clients
Description
Property (read-only); an object containing all the Flash clients or other Flash Communication Servers currently connected to the application. The object is a custom object like an array, but with only one property, length. Each element in the object is a reference to a Client object instance, and you can use the length property to determine the number of users connected to the application. You can use the array access operator ([]) with the application.clients property to access elements in the object.
The object used for the clients property is not an array, but it acts the same except for one difference: you can't use the following syntax to iterate through the object:
for(var i in application.clients) {
// insert code here
}
Instead, use the following code to loop through each element in a clients object:
for (var i = 0; i < application.clients.length; i++) {
// insert code here
}
Example
This example uses a for loop to iterate through each member of the application.clients array and calls the method serverUpdate on each client:
for (i = 0; i < application.clients.length; i++){
application.clients[i].call("serverUpdate");
}