This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
113
Chapter 4
CHAPTER 4
Applications, Instances, and
Server-Side ActionScript
FlashCom applications can be scripted on the server using Server-Side ActionScript
(SSAS) and the server-side objects available to it. With SSAS, you can control who
can access an application and what resources are available to each user. You can con-
trol Flash movies remotely, switch the stream source that people are watching, chain
streams between FlashCom Servers, and access and update databases.
Server-Side ActionScript is a little different from the client-side ActionScript used to
script Flash movies. This chapter describes how to write Server-Side ActionScript
and work with the objects that control application instances and the Flash movies
that connect to them. Scripting on the server is as important as scripting in Flash.
This chapter is designed to get you going on the server side of things and to prepare
you for the chapters that follow. Future chapters on streams, remote shared objects,
and remote methods all describe how to script communication objects within Flash
and their counterparts on the server.
Scripting Application Instances
A single FlashCom Server can host many different applications. Each application gets
its unique server-side behavior from the scripts associated with it. You create an
application by adding a subdirectory to an applications directory on the server. Mac-
romedia refers to each applications subdirectory as a registered application directory
because creating it registers an application with FlashCom. In turn, the server makes
instances of the application available to Flash movies that try to connect to them.
Every registered application directory can also be thought of as the home directory
for that application. You can script an application by adding a main.asc file to the
application’s home directory. For example, adding a subdirectory named
courseLobby to an applications directory creates a new application named
courseLobby. The main.asc file in the courseLobby directory gives the application its
unique server-side behavior. Server-Side ActionScript files, such as main.asc, are text
files containing source code. They can be created with any plain text editor, such as

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.