Client-Server Script Interdependence - MACROMEDIA FLASH MEDIA SERVER 2-DEVELOPING MEDIA Develop Manual

Developing media applications
Table of Contents

Advertisement

If your SWF file is on the same computer that is running the Flash Media Server, you can use
rtmp:/appName/instanceName as a shortcut version of rtmp://server.domain.com/appName/
instanceName. If you are authoring your application on a development server and don't use a
relative path in your SWF files, moving all of your SWF files to a production server could
create some extra work, because each Uniform Resource Identifier (URI) in the
statement in your SWF files must be edited to connect to the
NetConnection.connect()
production server rather than to the development server.
If you use a relative path, Flash Player assumes that the computer that is hosting the SWF file
is the Flash Media Server, and that the directory that contains the SWF file is the correct
application directory. As long as the application has the same name on both the development
and production servers, you don't need to edit any URIs.
If the SWF file never resides on the same computer as the Flash Media Server, an absolute
path is required and must be edited if files are moved at production time.

Client-server script interdependence

Because the client-side and server-side ActionScript code are part of the same application,
they must work interdependently. One example of the interdependency between the client
and server code is the server-side ActionScript
method, which acts differently
call()
according to which object it is associated with—a client-side NetConnection object or a
server-side Client object.
For example, the following code example shows how you could create a network connection
on the client side, and then make a call to it from the server side:
// This is client-side ActionScript in the FLA file.
var my_nc:NetConnection = new NetConnection();
my_nc.someClientMethod = function()
{
// code here
}
my_nc.connect("rtmp://hostname:port/appname");
// This is server-side ActionScript in the main.asc file.
clientObj.call("someClientMethod");
The parameter passed to
must be a previously defined method of the
clientObj.call()
client-side NetConnection object. This is because any method in the client code that the
server can call must be a property of a client-side NetConnection object.
84
Application Development Tips and Tricks

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MEDIA SERVER 2-DEVELOPING MEDIA and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash media server 2

Table of Contents