|
|
|
How to create a sample application using Red5 and Flash
Author: Sunil Kumar Gupta | Email Website : allinone.co.nr
Advertisement
Drag an Alert component from window—components in the library. Open the Action-
Frame and write the following lines of code
codeimport
mx.controls.Alert;
var nc:NetConnection = new NetConnection();
nc.val = this;
nc.onStatus = function(info){
switch(info.code){
case "NetConnection.Connect.Success":
Alert.show("Got connected with application);
this.val.callServer();
break;
case "NetConnection.Connect.Failed":
Alert.show(info.application);
break;
case "NetConnection.Connect.Rejected":
Alert.show(info.application);
break;
case "NetConnection.Connect.Closed":
Alert.show("Client Disconnected");
break;
}
};
nc.connect("rtmp://localhost/sample");
function callServer(){
var resultObj:Object = new Object();
nc.call("sayHello", resultObj,"Your Name");
resultObj.onResult = function(str){
Alert.show(str); //This will display "Hello World! Your Name"
}
};
}
Now save the application and name it to sample.fla(user preferred)
The above code is Action script 1 code; you can put this code in external .As file and
refer it in the application. Since this is not in the scope of this tutorial, so we will follow
the above code.
Finish:- Run your flash client and if its get successfully connect with Red5 server, it will
display an alert box saying “Hello World! Your Name”
With the help of above tutorial, you can extend your application to any level.
|
| | 1 | 2 | 3 | 4 | 5 | 6 | |
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section
Submit your Tutorial at Click Here
|
|
|