
84
Application Development Tips and Tricks
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
NetConnection.connect()
statement in your SWF files must be edited to connect to the
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
call()
method, which acts differently
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
clientObj.call()
must be a previously defined method of the
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.
Содержание FLASH MEDIA SERVER 2-DEVELOPING MEDIA
Страница 1: ...Developing Media Applications ...
Страница 6: ...6 ...
Страница 10: ...10 About This Manual ...
Страница 36: ...36 Flash Media Server Architecture ...
Страница 80: ...80 Debugging and Monitoring Applications ...
Страница 106: ...106 Application Development Tips and Tricks ...
Страница 114: ...114 ...