Development Tips
Here are some tips that I gleaned from the various Media Server online and Help file .pdf documents that Adobe has made available. This will give you a better idea of what’s involved in developing Flash Media Server applications. However, to actually start developing your own applications you’ll need to access these resource materials directly and read them in much greater detail.
- Setting up the server first: Make sure that the server is running before testing and publishing your applications.
- Specifying the server URI: Use the Flash authoring
environment on the same computer that is running the Flash Media Server. If not,
you need to add your server name to all of the connect commands. 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");
- Specifying publishing formats: Configure Flash to publish both SWF and HTML files. To specify formats to be created during publishing, select File > Publish Settings in the authoring environment.
- Writing client-side ActionScript code: In most situations, your client-side ActionScript code should be attached to a layer on the first keyframe of your FLA file, not to individual objects. Also, client-side code in files published for Flash Player 7 or later is case-sensitive.
- Writing server-side ActionScript code: Always put code for applications using server-side ActionScript in a server-side script file. Name the file main.asc (or it can have a name such as registered_app_name.asc) and use the Flash ActionScript editor or the JavaScript editor to write it.
Media Server Application Deployment
The following five-step process summarizes the tasks needed to deploy a Flash Media Server application. Each task is discussed at length in the Media Server Software Help files, where you can review them in more detail.
- Select a name for your new application and register the application with the server. In the Flash Media Server applications directory, create a new directory of the same name.
- In Flash, create a FLA file that includes a new NetConnection statement
containing the registered application name and, if applicable, the application
instance in the URI.
For example:
my_nc = new NetConnection(); my_nc.connect("rtmp://myDomain.com/registered_app_name");
This statement connects the client to the registered_app_name application.
- Save the FLA file. You can store the FLA file anywhere; it is a source file used to create the SWF and is not part of the deployed application.
- Put all script files containing server-side ActionScript into the registered
application directory, in the Flash Media Server applications directory, or in a
/scripts directory created within the registered application directory.
Your server-side script file can be named main.asc or registered_app_name.asc.
- Publish the SWF file for your application in a directory accessible to your clients but that Flash Media Server does not use.
Depending on your application, additional steps might be involved; however, these five steps are necessary for all applications, regardless of their functionality.