Create Flash Client app (swf) to access Red5 server app.

HERE IS THE CODE:

import flash.net.NetConnection;
import flash.net.Responder;

var nc:NetConnection = new NetConnection();
nc.connect(“rtmp://localhost/testapp”);
nc.addEventListener(NetStatusEvent.NET_STATUS, netConnectionHandler);
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);

var nr:Responder = new Responder(netResponderHandler);
nc.call(“add”, nr, 2, 3);

function netConnectionHandler(evt:NetStatusEvent)
{
trace(“status: ” + evt.info.code);
}

function securityErrorHandler(evt:SecurityErrorEvent):void {
trace(“securityErrorHandler: ” + evt);
}

function netResponderHandler(serverResult:Object)
{
trace(“The result is ” + serverResult);
}

By admin