Macromedia Flash Communication Server MX 1st ed Edition Kevin Towes 2024 scribd download
Macromedia Flash Communication Server MX 1st ed Edition Kevin Towes 2024 scribd download
Macromedia Flash Communication Server MX 1st ed Edition Kevin Towes 2024 scribd download
https://ebookultra.com
https://ebookultra.com/download/macromedia-flash-
communication-server-mx-1st-ed-edition-kevin-
towes/
https://ebookultra.com/download/sams-teach-yourself-macromedia-flash-
mx-2004-in-24-hours-sams-teach-yourself-phillip-kerman/
ebookultra.com
https://ebookultra.com/download/macromedia-coldfusion-mx-
development-1st-edition-eric-ladd/
ebookultra.com
https://ebookultra.com/download/how-to-use-macromedia-dreamweaver-mx-
and-fireworks-mx-1st-edition-lon-coley/
ebookultra.com
https://ebookultra.com/download/flash-mx-games-actionscript-for-
artists-nik-lever/
ebookultra.com
Flash MX ActionScript Designer s Reference 1st Edition
Sham Bhangal
https://ebookultra.com/download/flash-mx-actionscript-designer-s-
reference-1st-edition-sham-bhangal/
ebookultra.com
https://ebookultra.com/download/how-to-do-everything-with-macromedia-
flash-1st-edition-bonnie-blake/
ebookultra.com
https://ebookultra.com/download/flash-mx-2004-at-your-fingertips-get-
in-get-out-get-exactly-what-you-need-1st-edition-sham-bhangal/
ebookultra.com
https://ebookultra.com/download/managerial-communication-1st-ed-
edition-bell/
ebookultra.com
https://ebookultra.com/download/server-study-guide-2nd-ed-edition-
brad-hryhoruk/
ebookultra.com
Macromedia Flash Communication Server MX 1st ed
Edition Kevin Towes Digital Instant Download
Author(s): Kevin Towes
ISBN(s): 9780735713338, 0735713332
Edition: 1st ed
File Details: PDF, 2.42 MB
Year: 2002
Language: english
Developing Communication
Applications
Macromedia Flash Communication Server MX
™
macromedia ®
Trademarks
Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver,
Authorware, Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage
Designer, Backstage Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, Design in Motion, Director,
Director Multimedia Studio, Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme
3D, Fireworks, Flash, Fontographer, FreeHand, FreeHand Graphics Studio, Generator, Generator Developer’s Studio, Generator
Dynamic Graphics Server, Knowledge Objects, Knowledge Stream, Knowledge Track, Lingo, Live Effects, Macromedia,
Macromedia M Logo & Design, Macromedia Flash, Macromedia Xres, Macromind, Macromind Action, MAGIC, Mediamaker,
Object Authoring, Power Applets, Priority Access, Roundtrip HTML, Scriptlets, SoundEdit, ShockRave, Shockmachine,
Shockwave, Shockwave Remote, Shockwave Internet Studio, Showcase, Tools to Power Your Ideas, Universal Media, Virtuoso,
Web Design 101, Whirlwind and Xtra are trademarks of Macromedia, Inc. and may be registered in the United States or in other
jurisdictions including internationally. Other product names, logos, designs, titles, words or phrases mentioned within this
publication may be trademarks, servicemarks, or tradenames of Macromedia, Inc. or other entities and may be registered in
certain jurisdictions including internationally.
Third-Party Information
Speech compression and decompression technology licensed from Nellymoser, Inc. (www.nellymoser.com).
This guide contains links to third-party websites that are not under the control of Macromedia, and Macromedia is not
responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your
own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia
endorses or accepts any responsibility for the content on those third-party sites.
Copyright © 2002 Macromedia, Inc. All rights reserved. This manual may not be copied, photocopied, reproduced,
translated, or converted to any electronic or machine-readable form in whole or in part without prior written approval of
Macromedia, Inc.
Acknowledgments
Director: Erick Vera
Producer: JuLee Burdekin
Writing: Jay Armstrong, Jody Bleyle, JuLee Burdekin, Barbara Herbert, and Barbara Nelson
Editing: Mary Ferguson, Anne Szabla
Multimedia Design and Production: Aaron Begley and Benjamin Salles
Print Design, Production, and Illustrations: Chris Basmajian
Macromedia, Inc.
600 Townsend St.
San Francisco, CA 94103
CONTENTS
INTRODUCTION
About This Manual .................................................. 5
Intended audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
About the Flash Communication Server documentation . . . . . . . . . . . . . . . . . . . . . . . . . 5
Typographical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Additional resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
CHAPTER 1
About Flash Communication Server .................................. 7
Overview of Flash Communication Server architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Flash Communication Server objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Applications and application instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
File types used by Flash Communication Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Setting up your development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Connecting to the server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Writing your first application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
CHAPTER 2
About Flash Communication Server Applications . . . . . . . . . . . . . . . . . . . . . 23
About Flash Communication Server services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
The Flash Communication Server design model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Designing Flash Communication Server applications . . . . . . . . . . . . . . . . . . . . . . . . . . 29
CHAPTER 3
Sample Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
About the samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Sample 1: Recording a Stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Sample 2: Shared Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Sample 3: Shared Ball . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Sample 4: Hello Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Sample 5: Text Chat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Sample 6: Record a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3
CHAPTER 4
Application Development Tips and Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Application design and development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Debugging your application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Adding a privacy module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Coding conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
File types and paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Snapshots and thumbnails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Application object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Camera object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Client object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
NetConnection object (client-side) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
NetStream object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
SharedObject object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Stream object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Microphone object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Video object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
CHAPTER 5
Application Server Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Connecting through Flash Remoting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Sample 1: Simple Remoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Sample 2: Sending Mail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Sample 3: Recordset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
APPENDIX
Flash Communication Server Management Tools . . . . . . . . . . . . . . . . . . . . 97
Using the Communication App inspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Using the NetConnection Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4 Contents
INTRODUCTION
About This Manual
Intended audience
This manual is a “how-to” book that takes you, the Flash Communication Server developer,
through the steps involved in setting up a development environment and creating Flash
Communication Server applications, including debugging and testing applications.
You should already be familiar with Flash MX authoring, ActionScript, and the Flash Player. You
should also have some familiarity with JavaScript (because it forms the basis of server-side
ActionScript), client-server models, and networking concepts.
Additional resources
The Flash Communication Server documentation was written before the code in the product was
complete. Therefore, there may be discrepancies between the final implementation of the
product’s features and how they are documented in this manual. For a list of known discrepancies,
see the documentation update website (http://www.macromedia.com/go/
flashcom_documentation_update).
The Flash Communication Server Support Center (http://www.macromedia.com/go/
flashcom_support) is updated regularly with the latest information on Flash Communication
Server, as well as advice from expert users, advanced topics, examples, tips, and other updates.
6 Introduction
CHAPTER 1
About Flash Communication Server
Macromedia Flash Communication Server MX, the new platform for interactive personal
communication, integrates Macromedia Flash MX multimedia with live audio, video and data
streaming over networks, provides a system for storing recorded audio and video streams and
shared data objects, and enables the real-time sharing of synchronized distributed data among
multiple clients. This technology unites communication and applications, providing audio, video,
and data streaming between Macromedia Flash Player 6 clients.
The Flash Communication Server incorporates a number of features that support and enable the
creation of next-generation communication applications. In particular, the Flash Communication
Server:
• Provides an efficient, high-performance runtime for executing code, content and
communications.
• Integrates content, communications, and application interfaces into a common environment.
• Provides powerful and extensible object models for interactivity.
• Enables rapid application development through components and re-use.
• Enables the use of web and data services provided by application servers.
• Embraces connected and disconnected clients.
• Enables easy deployment on multiple platforms and devices.
7
Communications pass through the Flash Communication Server and are delivered to the client—
the Flash Player on a user’s computer—by means of the Macromedia Real-Time Messaging
Protocol (RTMP). When a Flash movie uses Flash Communication Server, the player connects
to the server, which provides a flow of information, called a network stream, to and from the
client. Other users can connect to the same server and receive messages, data updates, and
audio/video streams
Communications pass through the Flash Communication Server and are delivered to the Flash Player.
As the Flash Communication Server developer, you make this connection happen by working in
the Flash authoring environment to create a Flash movie that uses client-side ActionScript
commands. The Flash movie is the client element of your application. You can increase the
capabilities of your application by using server-side ActionScript. The client-side ActionScript
and the server-side ActionScript, combined, form the Flash Communication Server application
FLASH AUTHORING
Client-side .swf
component
Flash Communication
JAVASCRIPT EDITOR Server application
Server-side .asc
component
8 Chapter 1
The Flash Communication Server lets you stream live media (audio, video, and data) or record
data to be played later, as illustrated below.
SERVER
NetStream object
Client publishes
Players
Live stream
SERVER
Players
Recorded stream
10 Chapter 1
Flash Communication Server objects
As mentioned earlier, Flash Communication Server provides two application program interfaces
(APIs): a client-side API and a server-side API. The client-side API provides the following objects:
Camera, Microphone, NetConnection, NetStream, SharedObject, and Video. For more
information on using these objects, see the Client-Side Communication ActionScript Dictionary.
The server-side API provides the following objects: Application, Client, NetConnection,
SharedObject, and Stream. For more information on using these objects, see the Server-Side
Communication ActionScript Dictionary.
As you can see, some objects have the same name in both APIs, such as NetConnection. However,
a client-side object and a server-side object of the same name don’t provide the same functionality.
In addition, some client-side objects have server-side counterparts, but others do not. The
following sections briefly describe each client-side and server-side object, then explain how some
of them work together to allow client-server communications.
Client-side objects
These objects are used only in client-side ActionScript. For more information about these objects,
see the Client-Side Communication ActionScript Dictionary.
Camera object The client-side Camera object lets you capture video from a video camera
attached to the computer that is running the Flash Player. When used with the Flash
Communication Server, this object lets you transmit, display, and optionally record the video
being captured. With these capabilities, you can develop communication applications such as
videoconferencing, instant messaging with video, and so on.
You can also use a Camera object without a server (for example, to view a video feed from a
webcam attached to your local system).
Microphone object The client-side Microphone object lets you capture audio from a
microphone attached to the computer that is running the Flash Player. When used with the Flash
Communication Server, this object lets you transmit, play, and optionally record the audio being
captured. With these capabilities, you can develop communication applications such as instant
messaging with audio, recording presentations so others can replay them at a later date, and so on.
You can also use a Microphone object without a server—for example, to transmit sound from
your microphone through the speakers on your local system.
NetConnection object The client-side NetConnection object allows the Flash client to open a
TCP socket on the Flash Communication Server for continuous exchange of data using the Real-
Time Messaging Protocol (RTMP). You can also use the NetConnection object to connect to an
application server (see Chapter 5, “Connecting through Flash Remoting,” on page 85), but this
manual focuses on using the NetConnection object to communicate with the Flash
Communication Server.
NetStream object The client-side NetStream object opens a one-way streaming connection
between the Flash Player and the Flash Communication Server through a connection made
available by a client-side NetConnection object. A NetStream object is like a channel inside a
NetConnection; this channel can either publish audio, video, and data, using the
NetStream.publish method, or subscribe to a stream and receive data, using the
NetStream.play method. You can publish or play live (real-time) data and play previously
recorded data. Multiple clients can play a given stream, but a stream can have only one publisher
at a time. For information about the creation and storage of recorded streams on the server, see
“Recorded stream files” on page 68.
1 If the Library panel isn’t visible, select Window > Library to display it.
2 Add an embedded Video object to the library by clicking the Options menu at the upper right
of the Library panel and choosing New Video.
3 Drag the Video object to the Stage and use the Property inspector to give it a unique name.
Server-side objects
These objects are used only in server-side ActionScript. For more information about these objects,
see the Server-Side Communication ActionScript Dictionary.
Application object The server-side Application object contains information about a Flash
Communication Server application instance that lasts until the application instance is unloaded.
The Application object lets you accept and reject client connection attempts, register and
unregister classes and proxies, and create functions that are invoked when an application starts or
stops, or when a client connects or disconnects.
Client object The server-side Client object represents each user’s connection to a Flash
Communication Server application instance. The Client object can receive messages sent by a
client-side NetConnection.call command, and can invoke methods of the client-side
NetConnection object. You can use the properties of the Client object to determine the version,
platform, and IP address of each client. Using the Client object, you can also set individual read
and write permissions of various application resources such as Stream objects and SharedObject
objects. For more information, see “Implementing dynamic access control” on page 57.
NetConnection object The server-side NetConnection object lets you create a two-way
connection between a Flash Communication Server application instance and an application
server, another Flash Communication Server, or another Flash Communication Server
application instance on the same server. You can also use server-side NetConnection objects to
create more powerful applications; for example, you could get weather information from an
application server, or share an application load with other Flash Communication Servers or
application instances.
Using this object, you can connect to an application server for server-to-server interactions using
standard protocols (such as HTTP), or connect to another Flash Communication Server for
sharing audio, video, and data using the Macromedia Real-Time Messaging Protocol (RTMP).
You can use Macromedia Flash Remoting with the Flash Communication Server to communicate
with application servers such as Macromedia ColdFusion MX, .NET, and J2EE servers. For more
information, see the Flash Remoting site (http://www.macromedia.com/go/flashremoting).
12 Chapter 1
Remote shared object. Remote shared objects are created on the client but are also available to the
server. They let you share data in real-time between multiple clients, and also store data for later
retrieval by the same or different applications. For more information about client-side remote
shared objects, see “Understanding shared objects” on page 14.
SharedObject object. Server-side shared objects let you communicate with client-side shared
objects and with objects on other Flash Communication Servers. For more information about
server-side shared objects, see “Understanding shared objects” on page 14.
Stream object. The server-side Stream object lets you handle each stream in a Flash
Communication Server application. The Flash Communication Server automatically creates a
Stream object when the NetStream.play or NetStream.publish method is called in a client-
side script. You can also create a stream in server-side ActionScript by calling the Stream.get
method. A user can access multiple streams at the same time, and there can be many Stream
objects active at the same time.
In the following table, the client-side calls on the left invoke the server-side calls on the right.
my_nc.connect application.onConnect
my_nc.close application.onDisconnect
In the following table, the server-side calls on the left invoke the client-side calls on the right.
14 Chapter 1
The flashcom application directory
When your Flash application requires the Flash Communication Server, you must place your
application data where the server can locate it.
During installation, you choose either a Developer Install or a Production Install of the Flash
Communication Server. In both cases, if you don’t have a Web server installed, the default
directory is C:\Program files\Macromedia\Flash Communication Server
MX\flashcom\applications for both client-side application files—SWFs and HTMLs—and
server-side application files—ASC files, recorded stream (FLV) and remote shared object (FSO)
files, and your FLA source files.
• If you choose Developer Install, you can specify a different default directory during
installation, but Flash Communication Server will expect to find both client-side and server-
side files in subdirectories this directory. The advantage of choosing Developer Install is that
you can run the samples and test your applications from a single directory in the
\flashcom\applications directory that has the same name as your application. That is, for
convenience during development, client-side application files are stored in the same directory
with your server-side application files.
• If you choose Production Install, you can specify a different default directory for client-side
files and a different default directory for server-side files. Flash Communication Server will
know where to look for the files it needs. The advantage of choosing Production Install is that
your client-side application files can be accessible through a web server, while your server-side
application files will not be accessible to a user browsing your Web site.
For organizational purposes during your development work, it’s convenient to store all your client
and server application files (FLA, SWF, HTML, and ASC) in this subdirectory. When you deploy
your application, you can place your SWF and HTML files in any location. However, the
chat_App subdirectory must remain on the server, along with any ASC files used by the
application. The server-side files (your ASC, FLV, FSO, and FLA files) should not be in your web
root directory when you deploy the server and applications. Only your SWF and HTML files
should remain inside the web publishing directory.
If you chose Developer Install and then want to deploy your applications on the same machine,
you’ll want to separate client files from your server-side files. To do so, you can either reinstall the
server (choosing Production Install) and then relocate your files to the appropriate locations, or
you can change the configuration settings in the administration XML files as described in
Managing Flash Communication Server and then relocate your files to the appropriate locations.
In all cases, you must create a directory in the server-side directory that has the same name as the
application you connect to when issuing the NetConnection.connect command.
For example, suppose you have an application called chat_App:
NetConnection.connect("rtmp://myServer.myDomain.com/chat_app")
You must create a subdirectory named chat_App in your server-side flashcom application
directory. Suppose also that this application uses some server-side scripting stored in a file called
main.asc. You must place main.asc in this same directory.
Note: You must create a subdirectory that matches your application name even if you have no server-side script files
to place there. This is because Flash Communication Server stores any stream or shared object files created by your
application in subdirectories of this directory (see “File types and paths” on page 67). Also, the existence of this
directory tells the Flash Communication Server that the application is authorized and that users can connect to
instances of this application.
16 Chapter 1
Setting up your development environment
To write Flash Communication Server applications, you must install the Flash MX authoring
software, Flash Communication Server, and the latest Flash Player. If you want to write
applications that capture audio or video, you also need to install a microphone or camera.
Additionally, if your application requires server-side scripts for your Flash Communication Server
applications, you’ll need a UTF-8 JavaScript editor, such as Macromedia Dreamweaver MX. Each
of these elements of the development environment is discussed in this section.
Flash MX authoring software If you haven’t already installed Flash MX, see Getting Started with
Flash Communication Server.
Flash Communication Server software If you haven’t already installed the server, see Getting
Started with Flash Communication Server.
Flash Player Make sure that you are using the latest version of the Flash Player. To download
the latest version, go to the Macromedia Flash Player Download Center
(http://www.macromedia.com/go/getflashplayer).
Camera and microphone To install a camera or microphone, follow the instructions that
accompany your device. For a list of cameras that are known to be compatible with Flash
Communication Server, see the documentation on camera compatibility on the Macromedia
website (http://www.macromedia.com/go/camera_compatibility). Cameras that aren’t on this list
may be compatible with Flash Communication Server, but haven’t been tested by Macromedia.
Many cameras contain a built-in microphone. You can also install a separate microphone, or for
best results, a microphone/headset combination.
After you’ve installed your devices, you can specify which camera or microphone Flash should use
by default. Right-click (Windows) or Control-click (Macintosh) while any Flash MX movie is
playing, choose Settings from the context menu, click the Microphone or Camera panel, and
select your preferred device from the pop-up menu.
Using a JavaScript editor You can use any text editor to write server-side ActionScript code,
which you’ll store in files with an extension of .asc. You may prefer to use software specifically
designed for writing web-based applications, such as Macromedia Dreamweaver MX, which
offers syntax highlighting and code hinting for ASC files.
If you want to include non-ASCII text in your server-side scripts, such as double-byte characters
used in Asian languages, you must use an editor that supports UTF-8 encoding. The Flash
Communication Server requires UTF-8-encoded ASC files in order to pass double-byte
characters from one client to another. For more information on setting up Dreamweaver MX for
double-byte languages, see “Writing double-byte applications” on page 57.
1 In a new Flash movie, begin opening a connection to the Flash Communication Server by
issuing the following command:
my_nc = new NetConnection();
Note that in both syntax examples for targetURI, you must specify rtmp (the Real-Time
Messaging Protocol) as the protocol for the connection. If you omit it, the Flash Player
assumes you want to make an HTTP connection to an application server, and your connection
will fail.
If the server is running on your local machine, you can use "localhost" as the host name in
the URI; this is often convenient during application development.
For example, the following code uses the new NetConnection constructor to create a new
connection object. Then, the object is connected to the server with the call to my_nc.connect.
// Makes a new connection object
my_nc = new NetConnection();
18 Chapter 1
Writing your first application
The Flash Communication Server installation includes a sample application called doc_connect
that transmits text through the server between two clients. By viewing the source file and then
recreating the application yourself, you’ll learn how to write a simple Flash Communication
Server application. This example is included only to illustrate how easy it is to implement client-
server communication using Flash Communication Server. Before starting to write your own
programs, see Chapter 2, “About Flash Communication Server Applications,” on page 23.
1 Create a directory named doc_connect in the flashcom application directory (by default, the
application directory is Flash Communication Server MX\flashcom\applications).
2 Open the doc_connect.swf file located in the \Macromedia\Flash
MX\flashcom_help\help_collateral\doc_connect directory.
Note: If the application doesn’t seem to be working, make sure the service is running; see “Starting the service” on
page 18.
After allowing access to the audio and video devices, you see two images: the live stream from the
camera and the published stream sent back from the server.
1 In the Flash authoring environment, select File > New to open a new file.
2 If the Library panel isn’t visible, select Window > Library to display it.
3 Add an embedded Video object to the library by clicking the Options menu at the upper right
of the Library panel and choosing New Video.
Options menu
4 Drag two embedded Video objects from the library onto the Stage and, in the Property
inspector, name them Live_video and Published_video.
6 If you haven’t already done so, create a directory named doc_connect in your flashcom
application directory. Save the file as doc_connect.fla in this directory. (By default, the
application directory is Flash Communication Server MX\flashcom\applications).
1 Select the keyframe (frame 1) in the Timeline and open the Actions panel (Window >
Actions).
Note: While re-creating the sample, make sure all of the ActionScript is attached to this first keyframe, and not to
the objects you create on the Stage.
2 Get the default camera and attach it to the Live_video embedded video object.
client_cam = Camera.get();
Live_video.attachVideo(client_cam);
20 Chapter 1
3 Create a connection function that connects to the Flash Communication Server, displays a
trace message indicating whether the connection was successful, and opens and instance of the
doc_connect application named room_01. Remember, you must specify the Real-Time
Messaging Protocol, rtmp.
function doConnect() {
}
Note: If your SWF is on the same computer that is running the Flash Communication Server, you can use
rtmp:/doc_connect/test as a shortcut version of rtmp://localhost/doc_connect/test. This usage indicates a
relative path and lets you move the files to a different server without changing the code. Also, remember that if
you aren’t using the Flash MX authoring environment on the computer that is running the Flash Communication
Server, substitute your server URL for “localhost”.
4 Create a function to publish the video by creating a network stream out_ns, attaching the
camera to that stream, and then publishing the stream as myTestStream.
function publishMe() {
}
Note: The statement out_ns.publish("myTestStream") omits the optional parameter howToPublish.
When this parameter is missing, the server automatically publishes the stream as live (that is, the stream is not
recorded while it is being published).
5 Create a function to play the published stream by creating a second network stream in_ns,
attaching the contents of that stream to the Published_video video object, and then playing
the stream named myTestStream that is being published by the server.
function playMe() {
1 Choose File > Publish Settings, select Flash and HTML, click Publish, and then click OK.
2 Choose Control > Test movie.
You see two video windows on the Stage, each displaying the same image.
3 To see how the movie looks in a browser, choose File > Publish Preview > Default, or press
Control+F12 (Windows) or Command+F12 (Macintosh).
Congratulations, you’ve just created and tested your first Flash Communication Server
application! This sample, of course, is for instructional purposes, and has both streams displayed
in a single movie. In a real application, one movie would publish the video feed and another
movie would play it.
This sample was included to show how just a few lines of code can implement client-server
communications using Flash Communication Server. Before you begin writing your own scripts,
be sure to read through the conceptual information provided in Chapter 2, “About Flash
Communication Server Applications,” on page 23, which provides an important overview of the
objects available to you as a Flash Communication Server developer.
22 Chapter 1
CHAPTER 2
About Flash Communication Server
Applications
With a few lines of code, your Macromedia Flash MX application (SWF) can communicate with
another client through the Macromedia Flash Communication Server MX. Using object-oriented
programming techniques and sound programming practices, you can write simple ActionScript
code to get started right away.
This chapter explains some ideas behind Macromedia Flash Communication Server MX and
describes the types of files you’ll generate. An overview of the ActionScript objects specific to
Flash Communication Server is also described here.
23
Passing data between clients In Chapter 1, the sample connection application (see “Writing
your first application” on page 19) connected to the server, opened a stream to publish some
video, and opened another stream to receive the data (play back the video). The only thing the
server was expected to do was to pass the video data through and back to the client. (In a real-life
scenario, of course, the video data would pass through the server to a different client at another
location.)
Client 1 Client 2
Server
Storing data for delivery to clients The Flash Communication Server can store information that
is useful to multiple clients—for example, a recorded video or the high score in a multiuser game.
Many samples in this manual rely on the server to store information. (For more information on
where data files are stored, see “File types used by Flash Communication Server” on page 16.)
Client 1 Client 2
Server
The Flash Communication Server stores information that is useful to one or more clients.
24 Chapter 2
Tracking client information You can use server-side ActionScript to collect and display
information regarding clients, transform data, moderate the communication, test conditions,
notify using e-mail and other means, and provide many other services. For example, later you’ll
work through samples that not only rely on the server to route information, but also expect the
server to keep track of client information. When you expect the server to provide some
application logic and return a result, you must provide the instructions in the form of server-side
ActionScript commands.
Client 1 Client 2
Server
The Flash Communication Server processes information and sends it back to the client.
Connecting to external sources You can also use server-side ActionScript to develop
applications that interact with other servers; for example, your application might access a
database, and application server, or another Flash Communication Server. In this way, server-side
ActionScript can be used to add dynamic content to your application.
Client 1 Client 2
SWF FILE
ActionScript
<HTML>
.swf
</HTML>
.swf
HTML FILE
Web server
directory
.html HTML
HTML wrapper
ASC FILE
.asc
.asc Server logic
Server-side .flv
ActionScript Flash Com
application directory
26 Chapter 2
When the user runs your Flash SWF file and the SWF file connects to the server, the server loads
the application and creates the application instance if it isn’t already running. The server accepts
the connection, creates a new Client object to represent the client application on the server, and
executes any server-side scripts that you have provided. The client also does its work, initiating
streams, sharing objects, and so on. The following sections describe this sequence of events in
more detail.
Note: Only the client application can initiate a communication session, and only the server can shut down an
application. Both the client and the server send and receive status messages, open and close streams, save and
share data, and end the network connection.
Application workflow
When the client connects to the server, the server calls onAppStart if the application instance
isn’t already running. Next, the server-side onConnect method is invoked with a newly created
Client object. The logic in this method determines whether to accept or reject the connection.
Back on the client side, the onStatus method is called to report whether the connection was
accepted or rejected. When the client closes the connection, the server-side onDisconnect
method is called. When the application is unloaded, onAppStop is invoked.
onAppStart
onStatus acceptConnection
close onDisconnect
Application is
unloaded
onAppStop
Connection flow
CLIENT SERVER
call("doThis",
"doThis",a,b
callback_obj,a,b)
clientObj.doThis(a,b)
onResult resultObj
Call flow from client to server, with result passed back to client
Conversely, if a server makes a call to the client, it can provide a callback object. The client should
contain a method corresponding to the one called by the server code. Again, the client can return
a result, and the server’s onResult handler is called on the callback object sent to the client.
CLIENT SERVER
client.call("doThis",
"doThis",a,b
callback_obj,a,b)
netConnection.doThis(a,b)
resultObj resultObj.onResult
Call flow from server to client, with result passed back to server
28 Chapter 2
Finally, here’s an overview of the remote shared object flow. A Flash client movie subscribes to a
remote shared object by issuing a SharedObject.getRemote command, and provides a
SharedObject.onSync method with it. The client then connects the remote shared object to the
NetConnection object by issuing a SharedObject.connect command. The server sends out a
synchronization message for the shared object, but no method on the server side is invoked. This
synchronization message causes the SharedObject.onSync method on the client to be called.
When the client, the server, or any other movie instance makes a change to the shared object, the
server again sends out a synchronization message for the shared object. Again, no server method is
called, and the synchronization message from the server causes the SharedObject.onSync
method on each client to be called.
getRemote("obj1") getRemote("obj1")
connect connect
obj1.data.x=4
30 Chapter 2
CHAPTER 3
Sample Applications
Sample Applications 31
You should have Flash MX configured to publish both SWF and
Specifying publishing formats.
HTML files. To specify formats to be created during publishing, choose File > Publish Settings in
the Flash MX authoring environment.
Writing client-side ActionScript code. Unless otherwise noted, your client-side ActionScript code
should be attached to a layer on the first keyframe of your FLA file, not to individual objects.
Writing server-side ActionScript code. For the samples that use server-side ActionScript code,
your main.asc file should be written in a JavaScript editor, such as Macromedia Dreamweaver
MX. For more information on appropriate JavaScript editors, see “Setting up your development
environment” on page 17. Also, remember that server-side code is case-sensitive.
Initializing your client-side code. Add the following code as the first two lines in each sample as
you re-create it (these lines are in each sample FLA but are not included in the steps for re-
creating the sample):
stop();
#include "netdebug.as"
The first line simply ensures that movies stop running before the sample starts. The second line
enables the use of the NetConnection debugger, which lets you trace and diagnose details about
the streams and shared objects your application is using. For more information on the debugger,
see “Using the NetConnection Debugger” on page 105.
Acknowledging the user’s right to privacy. Before recording or broadcasting anyone’s image or
voice, it’s important to inform that person of your intention and to gain their consent or
agreement. In the samples that illustrate how to record or broadcast audio or video, you’ll see
instructions to add a text box that informs users they are being recorded or broadcasted and
gives them the opportunity to exit the application. For a more robust means of letting users
decide whether they want to be recorded or broadcasted, or not, see “Adding a privacy module”
on page 60.
Monitoring running applications. If you have server administration privileges, you can view details
about an application while you are testing it, such as log messages it is generating, values of shared
objects, and so on. To do so, open the Communication App inspector in Flash MX (Window >
Communication App Inspector), connect to the Flash Communication Server, select the
application instance you want to monitor, and choose View Detail. For more information, see
“Using the Communication App inspector” on page 97.
32 Chapter 3
Re-creating the sample
The doc_record.fla file provides the ActionScript for getting a camera, attaching it to a Video
object, creating a network connection to the server, recording the camera data on an outgoing
stream to the server, and then playing that recorded stream in a second Video object.
When you record a stream in a Flash application, the server creates files with the extensions .flv
and .idx. For more information, see “Recorded stream files” on page 68.
See “Creating your working environment” on page 31 before you start to re-create the sample.
1 In the Flash MX authoring environment, select File > New to open a new file.
2 To add a Video object to your library, open the Library panel (Window > Library) and add an
embedded Video object by selecting New Video from the library’s Options menu.
3 Drag two embedded Video objects from the library onto the Stage, and give them the instance
names Live_video and Replay_video.
4 To add buttons to your movie, open the Components panel by selecting Window >
Components.
5 To add the button for recording, drag a push button from the Components panel onto the
Stage, placing it below the Live_video video object. In the Property inspector, give it the
instance name Record_btn, the label Record, and the click handler doRecord.
6 To add the button for playing, repeat the previous step to create a push button with the
instance name Play_btn, the label Play, and the click handler doPlay. Place this button
beneath the Replay_video video object.
7 To add the privacy message, select the Text tool and draw a text box. In the Property inspector,
select Static Text for the type of text box. Type (or copy and paste) text such as the following
text into the text box: Your image will be recorded or broadcasted and could be published at
a later date. If you don’t approve, please exit this application.
Note: Please note that this text is provided merely as an example, and the precise wording of the text that you
use will be dictated by the nature of your application and/or service and any privacy, legal, or other issues raised
by your application and/or service.
8 Create a directory named doc_record in your flashcom application directory, and save the file
as doc_record.fla in this directory.
1 Select the keyframe in the Timeline and open the Actions panel (Window > Actions).
2 In the Actions panel, stop the progress of the movie.
stop();
Sample Applications 33
4 In the initStreams function, make a connection to the server. Create the output stream for
sending the video data to the server, and the input stream for the data coming back from the
server. Then attach the input stream to the Replay_video video clip.
function initStreams() {
5 Create the event handler for the Record button. If the user selected the button when the label
was Record, then attach video data from the camera to the output stream and publish it. If the
button label is Stop, close the stream.
function doRecord() {
if (Record_btn.getLabel() == "Record") {
34 Chapter 3
6 Create the event handler for the Play button that plays the stream recorded on the server.
function doPlay() {
in_ns.play("my_recorded_stream");
1 In the Flash MX authoring environment, after you have saved your work, publish it by
selecting File > Publish.
2 Open the SWF file in the application directory or, in the Flash MX authoring environment,
choose Control > Test Movie.
1 In the Flash MX authoring environment, select File > New to open a new file.
2 From the toolbox, select the Text tool and draw a text box.
3 In the Property inspector (Window > Properties), select Input Text for the type of text box, and
give it the instance name TypingStage.
4 Create a directory named doc_text in your flashcom application directory, and save the file as
doc_text.fla in this directory.
1 Select the keyframe in the Timeline and open the Actions panel (Window > Actions).
Sample Applications 35
2 Open a connection to the server.
// Open connection to server
client_nc = new NetConnection();
client_nc.connect("rtmp:/doc_text/room_01");
3 Handle the messages coming from the server.
// Handle status message
client_nc.onStatus = function(info) {
trace("Level: " + info.level + " Code: " + info.code);
}
5 Get a remote shared object to hold the text data from the client.
// Create a remote shared object. client_nc.uri is the URI of the
// NetConnection the shared object will use to connect to the
// server.
text_so = SharedObject.getRemote("sharedtext", client_nc.uri, false);
6 When you get a shared object, make sure you connect to it.
// The following is very important, nothing happens otherwise
text_so.connect(client_nc);
7 Create an onSync callback function to handle the text message.
// Each time something changes in the shared object, the server
// sends out a synchronization message. This onSync handler
// updates the movie based on the information.
text_so.onSync = function(list) {
// Update the text area in the typing stage with the latest
// text from the shared object. The ’for’ loop condition searches
// through the list of changes, and the ’if’ condition ensures
// that we apply the relevant change only if someone other than
// this client has changed the value.
for (var i = 0; i < list.length; i++)
if (list[i].name == "textValue" && list[i].code != "success")
{
TypingStage.text = text_so.data.textValue;
break;
}
};
8 When the text in the typing stage changes, update the shared object with the new text.
// Update the shared object every time the user types in new text
TypingStage.onChanged = function()
{
text_so.data.textValue = TypingStage.text;
};
1 In the Flash MX authoring environment, after you have saved your work, publish it by
selecting File > Publish.
2 Open two instances of the SWF file in the application directory.
3 Type in one text box to see the other immediately updated.
36 Chapter 3
Sample 3: Shared Ball
This sample allows users to move a ball around the screen and to watch while other participants
move the ball around.
1 In the Flash MX authoring environment, select File > New to open a new file.
2 From the toolbox, select the Circle tool and draw a circle. With the circle still selected, convert
it to a movie clip by selecting Insert > Convert to Symbol, and name it ball. In the Property
inspector (Window > Properties), give it the instance name SharedBall_mc.
3 Create a directory named doc_sharedball in your flashcom application directory, and save the
file as doc_sharedball.fla in this directory.
1 Select the keyframe in the Timeline and open the Actions panel (Window > Actions).
2 In the Actions panel, stop the progress of the movie.
stop();
3 Create a new network connection to connect to the server and handle any status messages with
the onStatus function.
// Create a connection
client_nc = new NetConnection();
// Show connection status in output window
client_nc.onStatus = function(info) {
trace("Level: " + info.level + " Code: " + info.code);
};
Sample Applications 37
5 When you get a shared object, make sure you connect it to the NetConnection object.
// Connect to the shared object
ball_so.connect(client_nc);
6 Create the function that updates the shared object data with the position of the ball.
// Manipulate the ball
SharedBall_mc.onPress = function() {
this.onMouseMove = function() {
ball_so.data.x = this._x = _root._xmouse;
ball_so.data.y = this._y = _root._ymouse;
1 In the Flash MX authoring environment, after you have saved your work, publish it by
selecting File > Publish.
2 Open two instances of the SWF file in the application directory.
3 Move the ball in one instance to see the other immediately updated.
38 Chapter 3
To create the user interface for this sample:
1 In the Flash MX authoring environment, select File > New to open a new file.
2 From the toolbox, select the Text tool and draw a text box. In the Property inspector (Window
> Properties), select Input Text for the type of text box and give it the instance name User.
3 Add a dynamic text box for a debug window by selecting the Text tool and drawing another
text box. In the Property inspector, select Dynamic Text for the type of text box, and give it the
instance name Message.
4 To add the button for connecting to the server, open the Components panel (Window >
Components) and drag a push button onto the Stage. In the Property inspector, give it the
instance name Connect_btn, the label Connect, and the click handler doConnect.
5 Create a directory named doc_hello in your flashcom application directory, and save the file as
doc_hello.fla in this directory.
1 Select the keyframe in the Timeline and open the Actions panel (Window > Actions).
2 In the Actions panel, stop the progress of the movie.
stop();
Sample Applications 39
4 Create the event handler for the Connect button. If the user selected the button when the label
was Connect, then connect to the server. If the button label is Disconnect, close the
connection.
// Event handler for Connect_Btn
function doConnect() {
// Close connection
client_nc.close();
var msg;
_root.Message.text = msg;
40 Chapter 3
To write the server-side ActionScript for this sample:
1 Create a new file using your server-side ActionScript editor, and write an event handler for
when the user connects. In it, you’ll receive the name passed in by the client, accept the client
connection, create a message that uses the client’s name, and call the client msgFromSrvr
function to return the message.
application.onConnect = function(newClient, name) {
// Give this new client the same name as the user name
newClient.name=name;
2 Save the file as main.asc in a doc_hello directory under the flashcom applications directory.
Note: Save this main.asc file where you’ve chosen to store your server-side application files. For example, if you
chose Developer Install during installation, save this file to the same directory where you’ve stored the client-side
SWF file and its source FLA file. If you chose Production Install and you have a Web server, the Flash
Communication Server will look for your client-side files under \flashcom\applications in your Web server's root
directory and will look for your server-side application files (including this main.asc file) under \applications in the
directory you specified during installation. The <AppsDir> tag in the Vhost.xml server configuration file contains
the location of your flashcom application directory. For more information see Chapter 1, “The flashcom
application directory,” on page 15.
1 In the Flash MX authoring environment, after you have saved your work, publish it by
selecting File > Publish.
2 Open the SWF file in the application directory.
3 Overwrite the text in the login box by typing your name, then click Connect. You’ll see a
message like this one:
Hello! You are connected as: [your name]
Sample Applications 41
About the sample
In a chat room, you want to view current users dynamically. When users log in to a room, the list
should be updated; when users log off, they should be removed from the list. It’s best to do this
processing work on the server, because keeping data centrally on the server means that any client
can come and go, and the data will always be accurate and available.
In addition, in this example, the server doesn’t simply hand off the text from one client to
another, it actually makes changes to the message by adding the name of the user who typed it.
Because you expect the server to provide this functionality, you need to write some server-side
ActionScript to handle this work.
Finally, this example also illustrates how to dynamically add an instance name to a
NetConnection.connect command based on data entered by the user.
1 In the Flash MX authoring environment, select File > New to open a new file.
2 From the toolbox, select the Text tool and draw two text boxes. In the Property inspector
(Window > Properties), select Input Text for the type of text box, and give one the instance
name User, and the other, Room.
3 From the toolbox, select the Text tool and draw another text box. In the Property inspector,
select Input Text for the type of text box, and give it the instance name Message.
4 From the toolbox, select the Text tool and draw a fourth text box. In the Property inspector,
select Dynamic Text for the type of text box, and give it the instance name History.
5 To add a place where users are listed, open the Components panel (Windows > Components),
drag the List Box component onto the Stage, and give it the instance name People.
6 To add the button for connecting to the server, drag a push button from the Components
panel onto the Stage. In the Property inspector, give it the instance name Connect_btn, the
label Connect, and the click handler doConnect.
7 To add the button for sending messages, drag a push button from the Components panel onto
the Stage. In the Property inspector, give it the instance name Send_btn, the label Send, and
the click handler doSend.
8 Create a directory named doc_textchat in your flashcom application directory, and save the file
as doc_textchat.fla in this directory.
1 Select the keyframe in the Timeline and open the Actions panel (Window > Actions).
2 In the Actions panel, stop the progress of the movie.
stop();
42 Chapter 3
3 Provide a value for the maximum scrolling of the History text box component.
// Set maximum scroll
History.maxscroll = 1000;
4 Prevent the user from sending until after the user has connected to the server.
// Don’t allow the user to send until after connection
_root.Send_btn.setEnabled(false);
5 Create a new network connection.
// Open a connection to the server
client_nc = new NetConnection();
6 Provide an onStatus function to handle any status messages.
// If connection is closed, clear the History and the list
client_nc.onStatus = function(info) {
if (info.description == "NetConnection.Connect.Closed") {
History.text = "";
_root.People.removeAll();
}
}
7 Create the event handler for the Connect button. If the user selected the button when the label
was Connect, then connect to the server and update the buttons.
function doConnect() {
if (Connect_btn.getLabel() == "Connect") {
Sample Applications 43
9 In the same doConnect function, create the onSync method to handle the change in users.
// When the list of users_so is updated, refresh the
// People list box.
users_so.onSync = function(userList) {
_root.People.removeAll();
_root.History.text += msg;
_root.History.scroll = _root.History.maxscroll;
historyScroll.setScrollTarget(history);
historyScroll.setScrollPosition(_root.History.maxscroll);
}
}
11 If the label on the Connect button is Disconnect, then close the connection and reset the
buttons.
else if (Connect_btn.getLabel() == "Disconnect") {
// Close connection
_root.client_nc.close();
}
} // doConnect function ends here
12 Create an event handler for when the user selects Send. In this function, if there’s any text in
the Message input text box, call the server function, msgFromClient, and pass it the
Message.text text.
// Send the message text by calling the server message function
function doSend() {
44 Chapter 3
13 Create the setHistory function that the server calls to update the text in the History
dynamic text box.
// Update the History on the server with the message
client_nc.setHistory = function(msg) {
_root.History.text = msg;
}
1 Create a new file using your server-side ActionScript editor, and write the event handler
onAppStart for initializing the application variables.
application.onAppStart = function()
{
trace("Begin sharing text");
Sample Applications 45
Exploring the Variety of Random
Documents with Different Content
The Project Gutenberg eBook of The Germ
and mystery
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Language: English
BY
ROBERT EASTERLEY and JOHN WILBRAHAM.
“His . . . . . . . .
Prosequitur dictis portaque emittit eburna.”
MELBOURNE:
MELVILLE, MULLEN, & SLADE.
LONDON: HUTCHINSON & CO.
1892.
[All rights reserved.]
v
TABLE OF CONTENTS.
———♦———
PAGE
Preliminary . . . . . . . . . . . . 1
CHAPTER I.
Disappearances . . . . . . . . . . . 6
CHAPTER II.
The Red Sickness . . . . . . . . . . 13
CHAPTER III.
At Sea . . . . . . . . . . . . . 26
CHAPTER IV.
Overland . . . . . . . . . . . . . 36
CHAPTER V.
Among the Blacks . . . . . . . . . . 58
CHAPTER VI.
vi Left Alone . . . . . . . . . . . . 86
CHAPTER VII.
The Cars . . . . . . . . . . . . . 97
CHAPTER VIII.
Signor Davelli . . . . . . . . . . . 131
CHAPTER IX.
The Seed Beds . . . . . . . . . . . 167
CHAPTER X.
Leäfar . . . . . . . . . . . . . . 202
CHAPTER XI.
Escape . . . . . . . . . . . . . 233
Conclusion . . . . . . . . . . . . 267
1
PRELIMINARY.
It was delicious weather, warm enough for light silk coats in the
daytime, and cold enough for two pairs of blankets at night. We had
riding and sea-bathing to our hearts’ content, and even a rough kind
of yachting and fishing. The ocean was before us—we heard its
thunder night and day; and the lakes were behind us, stretching
away to the promontory which the Mitchell cuts in two, and thence
to the mouth of the Latrobe, which is the highway to Sale. Three
times a week a coach passed our door, bound for the Snowy River
and the more savage regions beyond. Any day for a few shillings we
could be driven to Lake Tyers, to spend a day amidst scenery almost
comparable with the incomparable Hawkesbury. Last of all, if we
grew tired of the bell-birds and the gum-trees and the roar of the
ocean, we were within a day’s journey of Melbourne by lake and
river and rail.
It was our custom to be out all day, but home early and early to
bed. We used to take our meals in a low long room which was well
aired but poorly lighted, whether by day or night. And here, when
tea was over and the womenkind had retired, we smoked, whenever,
3
as often happened, the evening was cold enough to make a shelter
desirable; smoked and chatted. There was light enough to see the
smoke of your pipe and the faces of those near you; but if you were
listening to the chatter of a group in the other end of the room the
faces of the speakers were so indistinct as often to give a startling
challenge to your imagination if you had one, and if it was
accustomed to take the bit in its teeth. I sometimes caught myself
partly listening to a story-teller in the other end of the room and
partly fashioning a face out of his dimly seen features, which quite
belied the honest fellow’s real countenance when the flash of a
pipelight or a shifted lamp revealed it more fully.
Jack and I were more of listeners than talkers, and we were usually
amongst the earliest who retired. But one evening there was a good
deal of talk about the new gold-field in the north-west, and a keen-
looking bushman who seemed to have just returned from the place
began to describe its whereabouts. Then I listened attentively, and
at one point in his talk, I started and looked over at Jack, and I saw
that he was already looking at me. I got up and left the room
without a sign to him, but I knew that he would follow me, and he
did. It was bright moonlight, and when we met outside we strolled
4
down to the beach together. It was a wide, long, and lonely beach,
lonely to the very last degree, and it was divided from the house by
a belt of scrub near a mile wide. We said not a word to one another
till we got quite near the sea. Then I turned round and looked Jack
in the face and said, “Why, man, it must have been quite near the
place.”
“No,” said he, “it may have been fifty miles or more away, their
knowledge is loose, and their description looser, but it must be
somewhere in the neighbourhood, and I suppose they are sure to
find it.”
“That might be,” said he, “if they believed you; but they would not
believe you, they would think you were simply romancing.”
“Well,” said I, “let it be a joint concern between you and me, and I’ll
do my best.”
Then we lit our pipes and walked home, and settled the matter in a
very few words on the way. I was to write, but all I should write was
to be read over to Jack, who should correct and supplement it from
his own memory. And no account of anything which was witnessed
by both of us was to stand finally unless it was fully vouched for by
the memory of both. Thus for any part of the narrative which would
concern one of us only that one should be alone responsible, but for
all of it in which we were both concerned there should be a joint
responsibility.
When I was quite a boy, scarce yet fifteen years old, I happened to
be living in a parish on the Welsh coast, which I will here call
Penruddock. There were some bold hills inland and some very wild
and rugged cliffs along the coast. But there was also a well-sheltered
beach and a little pier where some small fishing vessels often lay.
Penruddock was not yet reached by rail, but forty miles of a splendid
7
road, through very fine scenery, took you to a railway station. And
this journey was made by a well-appointed coach on five days of
every week.
There was one such story which was constantly reproduced under
various forms. Sometimes it was said to have happened in the last
generation; sometimes as far back as the civil wars, of which,
strange to say, a lively traditional recollection still remained in the
neighbourhood; and sometimes it seemed to have been handed
down from prehistoric times, and was associated with tales of
enchantment
8
and fairyland. In such stories the central event was
always the unaccountable disappearance of some person, and the
character of the person disappearing always presented certain
unvarying features. He was always bold and fascinating, and yet in
some way or other very repulsive. And when you tried to find out
why, some sort of inhumanity was always indicated, some
unconscious lack of sympathy which was revolting in a high degree
or even monstrous. The stories had one other feature in common, of
which I will tell you presently.
I went about with him a good deal at one time on fishing and
shooting excursions and made myself useful to him, and except that
he was rather cruel to dogs and cats, and had a nasty habit of
frightening children, I do not know that I noticed anything particular
about him. Not, at least, until one day of which I am going to tell
you. James Redpath and I were coming back together to
Penruddock, and we called at a cottage about two miles from the
village. Here we found a little boy of about four years old, who had
been visiting at the cottage and whom they wanted to send home.
They asked us to take charge of him and we did so. On the way
home the little boy’s shoe was found to have a nail or a peg in it that
hurt his foot, and we were quite unable to get it out. It was nothing,
however, to James Redpath to carry him, and so he took him in his
arms. The little boy shrank and whimpered as he did so. James had
under
10
his arm some parts of a fishing-rod and one of these came in
contact with the little boy’s leg and scratched it rather severely so as
to make him cry. I took it away and we went on. I was walking a
little behind Redpath, and as I walked I saw him deliberately take
another joint of the rod, put it in the same place and then watch the
little boy’s face as it came in contact with the wire, and as the child
cried out I saw quite a malignant expression of pleasure pass over
James’s face. The thing was done in a moment and it was over in a
moment; but I felt as if I should like to have killed him if I dared. I
always dreaded and shunned him, more or less, afterwards, and I
began from that date to associate him with the inhuman heroes of
my Welsh stories.
I don’t think that I should ever have got over the dislike of him
which I then conceived, but I saw the last of him, at least
Penruddock saw the last of him, about three months later. I had
been sitting looking over the sea between the pier and the cliffs and
trying to catch a glimpse of the Wicklow Mountains which were
sometimes to be seen from that point. Just then James Redpath
came up from the beach beyond the pier, and passing me with a
brief “good morning,” went away inland, leaving the cliffs behind
11
him. I don’t know how long I lay there, it might be two hours or
more, and I think I slept a little. But I suddenly started up to find it
high day and past noon, and I began to think of looking for some
shelter. There was not a cloud visible, but nevertheless two shadows
like, or something like, the shadows of clouds lay near me on the
ground. What they were the shadows of I could not tell, and I was
about to get up to see, for there was nothing to cast such a shadow
within the range of my sight as I lay. Just then one of the shadows
came down over me and seemed to stand for a moment between
me and the sun. It had a well-defined shape, much too well defined
for a cloud. I thought as I looked that it was just such a shadow as
might be cast by a yawl-built boat lying on the body of a large
wheelbarrow. Then the two shadows seemed to move together and
to move very quickly. I had just noticed that they were exactly like
one another when the next moment they passed out of my sight.
As I thought it all over and tried to persuade myself that I had been
dreaming I suddenly remembered that James Redpath had passed
by a few hours before, and as suddenly I came to the conclusion
that I should never see him again. And certainly he never was again
seen, dead or alive, anywhere in Wales or England. His father, and
his uncle, and their families, continued to live about Penruddock, but
Penruddock never knew James Redpath any more. Whether I myself
saw him again or not is more than I can say with absolute certainty.
You shall know as much as I know about it if you hear my story to
the end.
13
CHAPTER II.
THE RED SICKNESS.
But a public calamity just then befell Penruddock which made men
forget James Redpath’s disappearance. A pestilence broke out in the
place of which nobody knew either the nature or the source. It
seemed to spring up in the place. At least, all efforts to trace it were
unsuccessful. The first two or three cases were attributed to some
inflammatory cold, but it soon became clear that there were specific
features about it, that they were quite unfamiliar, that the disease
was extremely dangerous to life and highly infectious.
Then a panic set in, and I believe that the disease would soon have
been propagated all over England and farther, if it had not been for
the zeal and ability of two young physicians who happened very
fortunately to be living in the village just then. Their names were
Leopold and Furniss. I forget if I ever knew their Christian names.
We used to call them Doctor Leopold and Doctor Furniss. They had
finished their studies for some little time, but they found it advisable
15
on the score of health to take a longish holiday before commencing
practice, and they were spending part of their holiday at
Penruddock. They were just about to leave us when the disease I
am telling you of broke out.
The first case occurred in a valley about two miles from the village.
In this valley there were several cottages inhabited mostly by farm
labourers and artisans. These cottages lay one after another in the
direction of the rising ground which separated the valley from
Penruddock. Then there were no houses for a considerable space.
Then, just over the hill, there was another and yet another. The
disease had made its way gradually up the hill from one cottage to
another, day after day a fresh case appearing. Then there had been
no new cases for four days, but on the fifth day a new case
appeared in the cottage just over the brow of the hill. And when this
became known, also that every case (there had now been eleven)
had hitherto been fatal, serious alarm arose. Then, too, the disease
became known as the “red sickness.” This name was due to a
discoloration which set in on the shoulders, neck, and forehead very
shortly after seizure.
How the two doctors, as we called them, became armed with the
needful powers I do not know. They certainly contrived to obtain
some
16
sort of legal authority, but I think that they acted in great
measure on their own responsibility.
The excitement and terror in Penruddock were very great. All but the
most necessary business was suspended, and of social intercourse
during the panic there was next to none. Ten cases in all were
treated by the physicians, and four of these recovered. The last two
cases were three or four days apart, but they were no less malignant
in character: the very last case was one of the fatal ones. I learned
nothing of the treatment; but the means used to prevent the disease
spreading, besides the strict quarantine, were chiefly fire and lime.
Everything about the sick was passed through the fire, and of these
everything that the fire would destroy was destroyed. Lime, which
abounded in the valley, was largely used.
A month after the last case the two physicians declared the
quarantine at an end, and a month later all fear of the disease had
ceased. And then the people of the village began to think of
consoling themselves for the dull and uncomfortable time they had
had, and of doing some honour to the two visitors who had served
the village so well. With this double purpose in view a picnic on a
large
18
scale was organized, and there was plenty of eating and
drinking and speech-making and dancing, all of which I pass over.
But at that picnic I heard a conversation which made a very powerful
impression on me then, and which often has seemed to provide a
bond which binds together all the strange things of which I had
experience at the time and afterwards.
Mr.
19
Leopold stood with his back to an oak-tree, and I leant against
the fence beside him listening to him. He was a tall, dark man, with
a keen, thoughtful, and benevolent expression. He was quite strong
and healthy-looking, and there was a squareness about his features
that I think one does not often see in dark people. Mr. Furniss was of
lighter complexion and hardly as tall; there was quite as much
intelligence and benevolence in his face, but not so much of what I
have called thoughtfulness as distinguished from intelligence, and
there was a humorous glint in his eye which the other lacked. They
began to talk about the disease which had been so successfully dealt
with, and this was what they said:—
Leopold. The red sickness, of course. Can’t you see what I mean?
Furniss. No, I can’t. You’re too much of a mystic for me, Leopold;
but I’ll tell you what, England owes a debt to you and me, my boy,
for it was near enough to being a new edition of the black death or
the plague.
Leopold. Only the black death and the plague were imported, and
this
20
was indigenous. It sprung up under our noses in a healthy
place. It came from nowhere, and, thank God, it is gone nowhither.
Furniss. But surely the black death and the plague must have begun
somewhere, and they too seem to have gone nowhither.
Leopold. You’re right this far that they all must have had the same
sort of beginning. Only it is given to very few to see the beginning,
as you and I have seen it, or so near the beginning.
Furniss. Now, Leopold, I hardly see what you are driving at. I am not
much on religion, as they say in America, but I believe there is a
Power above all. Call that Power God, and let us say that God does
as He pleases, and on the whole that it is best that He should. I
don’t see that you can get much further than that.
Leopold. I don’t believe that God ever made the plague, or the black
death, or the red sickness.
Furniss. Oh, don’t you? Then you are, I suppose, what the
churchmen call a Manichee—you believe in the two powers of light
and darkness, good and evil. Well, it is not a bad solution of the
question as far as it goes, but I can hardly accept it.
Leopold. No, I don’t believe in any gods but the One. But let me
explain.
21
That is a nice dog of yours, Furniss. You told me one day
something about his breeding, and you promised to tell me more.
Furniss. Yes; but I have some distant cousins, and they have the
same breed and yet not the same, for they have cultivated it in quite
another direction.
Leopold. What are the differences?
Furniss. Our dogs are all more or less like Tommy here, gentle and
faithful, very intelligent, and by no means deficient in pluck. My
cousin’s dogs are fierce and quarrelsome, so much so that they have
not been suffered for generations to associate with children. And so
they have lost intelligence and are become ill-conditioned and low-
lived brutes.
Leopold. But I think I understood you to say that the change in the
breed did not come about in the ordinary course of nature.
Furniss. I believe not. I heard my grandfather say that his father had
told him that when he was a young man he had set about improving
22
the breed. He had marked out the most intelligent and best
tempered pups, and he had bred from them only and had given
away or destroyed the others.
Furniss. Just let me finish. It seems that while one brother began to
cultivate the breed upward, so to speak, another brother was living
in a part of the country where thieves were numerous and daring,
and there were smugglers and gipsies, and what not, about. And so
he began to improve the breed in quite another direction. He
selected the fierce and snappish pups and bred exclusively from
them.
Furniss. Just so, but I don’t quite see what you are driving at.
Leopold.
23
But one of them fulfils some obscure function in the
physique of the cow, some function certainly harmless and probably
beneficent, and the other is the malignant small-pox of the London
hospitals.
Furniss. So you mean to infer that in the latter case the germ has
been cultivated downwards by intelligent purpose.
Leopold. I don’t wish to use misleading words, but I will say that I
believe there are intelligences, not human, who have access to
realms of nature that we are but just beginning to explore; and I
believe that some of them are enemies to humanity, and that they
use their knowledge to breed such things as malignant small-pox or
the red sickness out of germs which were originally of a harmless or
even of a beneficent nature.
Furniss.
24
Just as my cousins have bred those wild beasts of theirs out
of such harmless creatures as poor Tommy’s ancestors.
Furniss. And you think that we can contend successfully against such
enemies.
Leopold. Why not? They can only have nature to work upon. And
very likely their only advantage over us is that they know more of
nature than we do. They cannot go beyond the limits of nature to do
less or more. As long as we sought after spells and enchantments
and that sort of nonsense we were very much at their mercy. But we
are now learning to fight them with their own weapons, which
consist of the knowledge of nature. Witness vaccination, and witness
also our little victory over the red sickness.
And so they got up and went back together to the dancers, nodding
to me as they went. I sat there for awhile, going over and over the
conversation in my mind and putting together my own thoughts and
Mr. Leopold’s.
Then I joined the company and was merry as the merriest for the
remainder
25
of the day. But that night I dreamt of strange-looking
clouds and of the shadows of invisible cars, and of demons riding in
the cars and sowing the seeds of pestilence on the earth and
catching away such evil specimens of humanity as James Redpath to
reinforce the ranks of their own malignant order.
26
CHAPTER III.
AT SEA.
I went in due course to Oxford, where I stayed the usual time. I did
not make any great failures there, nor did I gain much distinction. I
was a diligent reader, but much of my reading was outside the
regulation lines. The literature of my own country, the poetry of
mediæval Italy, and the philosophy of modern Germany, more than
divided my attention with classics and mathematics. Novels, mostly
of the sensational type, amused me in vacations and on holidays,
but very seldom found their way into my working days.