This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
144
|
Chapter 4: Applications, Instances, and Server-Side ActionScript
(Macromedia’s term for recording trace output), an Application.xml file must con-
tain the XML tag and value as follows:
<RecordAppLog>true</RecordAppLog>
Logging can create very large files over time, so it is often best to not make this
adjustment in an Application.xml file for an entire virtual host. An Application.xml
file can be placed in the home directory of the application that is being developed.
When logging is turned on, a stream file with an .flv extension and named after the
instance will be saved within a folder named after the application within the applica-
tions/admin/streams/logs/application directory. The file can be read using the Flash
Communication Server Log reader available as a separate download from Macrome-
dia. Please see Technote 16464:
http://www.macromedia.com/support/flashcom/ts/documents/flashcom_logging.
htm
There are other alternatives for generating log output and log files. Flash Remoting
can be used to send data to an application server where it can be stored in a data-
base or written to a text file. When Remoting is used, a custom logging function
must be called in place of trace( ). Similarly, custom Flash clients can receive data via
remote method calls where they can sort and analyze data before presenting it.
Remoting is described in Chapter 11, and remote method calls are covered in
Chapter 9. An application-level logging system is discussed in Chapter 12.
Organizing Test Scripts
During program development and testing, load( ) can be used to make testing of
many different SSAS files a little easier to manage. If you had to create a new applica-
tion home directory for every test script, you would end up with many different test
folders. One trick is to use different instances to test different scripts within a single
application home directory. One way to do this is to create a main.asc file with this
one statement in it:
load(application.name.split('/').pop( ) + ".asc");
Then you can create as many test files as you like in the application’s home direc-
tory. To run a test file, connect to an instance of your application with the same
name. Suppose, for example, you are working on an application named courseChat
and want to run different versions of the application’s main file. You may have sev-
eral main files named mainVersion1.asc, mainVersion2.asc, and so on. You can run
any one of these files by using the App Inspector to load the right instance name,
such as
courseChat/mainVersion2, and then reload it to check the output. If client
interaction is required, a test client can be set up to connect to rtmp:/courseChat/
mainVersion2.

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.