This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Summary of Communication Components
|
61
application on the FlashCom Server. For production-ready applications, though,
you should use a full RTMP URI, such as rtmp://
fcs.mydomain.com/app, where
fcs.mydomain.com is the name of the server where FlashCom is running, and app
is the name of the application folder. This parameter corresponds to the
appDirectory property.
Communication Components
A list of other communication component instance names. If you double-click
this parameter in the Properties panel, you can enter multiple instance names of
other communication components that coexist on stage with the SimpleCon-
nect component. When the SimpleConnect instance connects to a FlashCom
application, it shares its connection with the objects specified in the Communi-
cation Components list. You can directly manipulate this listener list using the
fcComponents property (an array).
You can create your own custom objects that can be recognized by the SimpleCon-
nect component. Simply create a connect( ) method for your object, and specify the
object’s name in the Communication Components list. Your object should be instan-
tiated on the parent timeline of the SimpleConnect instance.
How the component works
The SimpleConnect component connects a Flash movie to a FlashCom application
by invoking a client-side NetConnection.connect( ) method as soon as the instance
loads in the movie. The SimpleConnect component actually tries to connect with
both a standard RTMP and a tunneling RTMPT connection. Whichever connection
type responds first becomes the active URI of the connection. The connection is then
shared with the objects specified in the Communication Components parameter
(
fcComponents property) of the SimpleConnect instance.
When the user enters a name and clicks the Login button (or presses the Enter key),
the SimpleConnect component issues a NetConnection.call( ) method to the server-
side FCSimpleConnect.changeName( ) method. This method keeps track of the user’s
name, as entered in the SimpleConnect’s text field, and shares that data with other
communication components.
Because the SimpleConnect component doesn’t support common features, such as
entering a password in addition to a username, you may want to create a connection
manually as part of a custom login. The manual approach requires you to notify
other components of the connection’s status as discussed under “Forgoing the Sim-
pleConnect Component” at the end of this chapter.
UserColor
The UserColor component is a UI element that allows each user to choose a color to
represent her identity within the Chat and Cursor components. The UI of the

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.