This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
48
|
Chapter 2: Communication Components
methods between client-side and server-side ActionScript. The client-side Connec-
tionLight.connect( ) method issues a call( ) method to the server-side FCConnection-
Light.connect( ) method. The server-side connect( ) method uses the measurement
interval passed in to calculate a ping interval between the FlashCom application and
the Flash movie client. Based on the ping interval, Client.getStats( ) periodically cal-
culates the bandwidth statistic data and sends it to the Flash client via a server-side
Client.call( ) method. This continues until the client disconnects or until the client-
side ConnectionLight.close( ) method is invoked.
Enabling ConnectionLight without SimpleConnect
To use the ConnectionLight component without the help of the SimpleConnect
component, invoke ConnectionLight.connect( ) in your client-side ActionScript. The
following code example invokes the connect( ) method of the ConnectionLight
instance named
connLight_mc when the first onStatus( ) message is received over a
NetConnection object named
app_nc:
var app_nc:NetConnection = new NetConnection( );
app_nc.onStatus = function (info) {
if (info.code == "NetConnection.Connect.Success") {
trace("--successful connection");
}
if (!initConnLight) {
initConnLight = true;
connLight_mc.connect(this);
}
};
app_nc.connect("rtmp:/my_app");
For more on this technique, see “Forgoing the SimpleConnect Component” at the
end of this chapter.
Cursor
The Cursor component provides a visual representation of each connected user’s
mouse position within the Flash movie. The component displays each user’s login
name below a cursor indicating the position of the user’s mouse on stage, as seen in
Figure 2-6. The cursor is also shown in the user’s preferred color when used in con-
junction with the UserColor component, discussed later in this chapter.
Figure 2-6. The Cursor component displays cursor positions for each user

Get Programming Flash Communication Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.