Getting Started > Creating your working environment

 

Creating your working environment

This section explains what you need to know before creating Flash Communication Server applications.

Make sure the server is running. If you want to publish and test your applications, Flash Communication Server must be running.For more information, see Starting the service.

Specifying the server URI. The code in this chapter assumes you're using the Flash MX authoring environment on the same computer that is running the Flash Communication Server. If that isn't the case, add your server name to all the connect commands documented here. For example, if your server is running at myServer.myDomain.com, change a line like this:

new_nc.connect("rtmp:/doc_record/room_01");

to this:

new_nc.connect("rtmp://myServer.myDomain.com/doc_record/room_01");

Note: Be sure you use two slashes (//) after rtmp: in the revised code. The use of a single slash is supported only when the SWF application is served from the same computer where Flash Communication Server is running.

Specifying publishing formats. You should have Flash MX configured to publish both SWF and 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 applications that use server-side ActionScript code, place the code in a server-side script file. The file should be named main.asc (or it can have a name such as registered_app_name.asc) and should be written in a JavaScript editor, such as Macromedia Dreamweaver MX. Also, remember that server-side code is case-sensitive.

Loading components.asc. To use communication components in any application, you must load the components.asc file, located in the scriptlib directory. To load this file, create a server-side script file for your application, if you haven't already, name it appropriately (such as main.asc), and add the following code at the top:

load("components.asc");

Tip: You might find it sufficient to copy this file into any application directory that uses communication components, but be sure to name it appropriately.

Initializing your client-side code. Add the following code as the first line in each example as you re-create it:

#include "Netdebug.as"

This 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. You'll want to remove this line of code, however, before deploying your application. For more information on the debugger, see Using the NetConnection Debugger.

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.

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.