x


Enter your email address below to receive updates each time we publish new Video Tutorial.

Privacy guaranteed. We'll never share your info.

Red5 Tutorial - Create Client Application to Access Red5 Server Application

DEAR VISITOR , YOU ARE WATCHING : Red5 Tutorial - Create Client Application to Access Red5 Server Application .

[postlink] http://j2ee-tutorials-videos.blogspot.com/2011/02/red5-tutorial-create-client-application.html [/postlink] http://www.youtube.com/watch?v=6MLL_krbuqEendofvid [starttext] This is a Video Tutorial explains
Create a new fla file, and with frame 1 selected, open the Actions panel and type in the following 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);
}
First we import the namespaces flash.net.NetConnection and flash.net.Responder, then we create a new NetConnection object, and then we connect to the server app using the path rtmp://localhost/testapp (where testapp is the name of the contextPath inside red-web.properties of the server app). Then we add an event listener, NET_STATUS, that listens for status information of the connection (like Success, Failure, or InvalidApp. Then we add an event listener SECURITY_ERROR to listen for security errors.

Next we want to call the add() function on the server app, so we use this syntax:

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

We use nc.call("add", nr, 2, 3) to call the server app function, and we pass it the nr responder object. That object is created and passed an event handler called netResponderHandler() which will recieve the results of the add() function, as it's parameter. If we pass 2 and 3 to the add() function then netResponderHandler() will receive 5 as its serverResult parameter.
RUN THE FLA FILE: Click on Control in the top nav, then click Test Movie, and in the console the output should be:

status: NetConnection.Connect.Success
The result is 5


NOTE: If you get a status of NetConnection.Connect.InvalidApp, then try restarting your computer. That is what I had to do. I also noticed that when I restarted my computer, the testapp.war file had disappeared from my webapps directory where Red5 is installed (which is fine because it is not needed...it is only there to deploy the project...once it is deployed it is not needed anymore.)
[endtext]
This site does not store any files on its server.We only index and link to content provided by other sites.If you have any doubts about legality of content or you have another suspicions, feel free to contact us HERE - Thank you.

0 commentaires :

Post a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

You can see also

J2EE is an acronym for Java 2 Enterprise Edition. The Java 2 Enterprise Edition is Software that can be used along with the J2SE, the Java 2 Standard Edition which includes the compiler and the other fundamentals of Java. The J2EE software includes development and deployment systems for Java Servlet and Java ServerPages. Both of these combine Java and HTML to produce web pages on demand. Author Mohamed Habou . understand this powerful component of Java programming.

Android Cloud To Device Messaging Video Tutorial

JPA Video Tutorial

Spring MVC Video Tutorial

Spring Security Video Tutorial

Primefaces Video Tutorial

Struts Video Tutorial

free counters

Introduction to J2EE Videos Tutorials

Latest GWT Video Tutorials

Latest Spring Videos Tutorials

Latest Hibernate Videos Tutorials

Latest JAVA Video Tutorials

Latest Struts Videos Tutorials

J2EE is an acronym for Java 2 Enterprise Edition. The Java 2 Enterprise Edition is Software that can be used along with the J2SE, the Java 2 Standard Edition which includes the compiler and the other fundamentals of Java. The J2EE software includes development and deployment systems for Java Servlet and Java ServerPages. Both of these combine Java and HTML to produce web pages on demand. VTC Author Mohamed Habou takes you on a step by step guide to understanding this powerful component of Java programming.