This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Video Conference and Video Window
Finally, the deleteVersion( ) method, shown in Example 13-29, is called when the
Delete Version button is clicked and the user has control of the shared text area. It
deletes the text in the version slot the user is currently viewing. Then it adjusts the
slot numbers and
length property so the version numbers run continuously from
beginning to end without interruption.
The SharedText component shown here is quite simple. Many more features, such as
text formatting and text archiving, could be added. However, this simple compo-
nent has proven one of the most successful for making online meetings useful—espe-
cially the versioning feature. The shared area can be used to keep track of evolving
task lists; to share, explain, and change source code; and to edit short memos or
notices in advance of publication.
Now that we have the TextChat and SharedText components under our belts, let’s
look at a more complex video conferencing component.
Video Conference and Video Window
In a video conference application, each user’s client publishes a stream that may
carry video, audio, and other data. Each client must somehow be made aware of
each stream being published by other clients so that they can all be played. The Vid-
eoConference component presented here uses a simple stream naming convention.
Each stream is created within the component namespace and is named using each
user’s unique username. For example:
where blesser is a username and users is a subdirectory under the component’s
name, in this case,
main. The name of the stream is presence. It also creates a shared
object that contains information about the current state of the stream. The shared
object has the same name as the stream.
Example 13-29. The deleteVersion( ) method
function deleteVersion (ev) {
var len =;
if (len < 1) {
for (var i = versionStepper.value; i < len; i++) {[i] =[i+1];
delete messages[len]; = len-1;
disableButtons( );
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Chapter 13: Building Communication Components
The VideoConference component, shown in Figure 13-11, displays a separate pop-
up window that shows video and plays audio for each incoming stream and contains
a drop-down menu that shows information about the stream based on the informa-
tion in the shared object. The VideoConference component also creates a publishing
window that allows the user to control his outgoing video and audio and updates the
shared object associated with the stream.
To create a pop-up window that plays all remote users’ streams, the component
must know the username of each connected user. The component could create a
shared object on the server containing usernames in the same way the PeopleList and
PeopleGrid components do. However, since those components already manage a
shared object with information about each user, the VideoConference component
simply uses the PeopleList or PeopleGrid shared object. When an instance of a Vid-
eoConference component exists in a Flash movie, it can be initialized this way:
videoConference.userName = application.user.userName;
videoConference.userList = peopleList.peopleList; =;
Once the userName, userList, and nc properties are set, the component’s enterConfer-
ence( ) method from the file, shown in Example 13-30, is called.
Among other things, it saves a reference to the people shared object named
and sets itself up as a listener on it. If the shared object has already connected, enter-
Conference( ) make sure the VideoConference.onSync( ) method is called once with a
list of information objects—one for each user. See “Listenable Shared Objects” earlier
Figure 13-11. Video conference pop-up windows; the blesser window shows the publishing controls
in a drop-down list

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.