|
|
|||||
Регистрация: Jan 2009
Сообщений: 10
|
вызов функций серверного скрипта
Добрый ..., описую ситуацию: стоит сервер Ред5 (через него транслируется потоковое видео, звук т.е. в роде как рабочий). Размещаю на нём
в C:\Program Files\Red5\webapps\oflaDemo серверный скрипт main.asc: application.onConnect = function( client ) { client.serverHelloMsg = function( helloStr ) { return "Hello, " + helloStr + "!"; } application.acceptConnection( client ); } http://help.adobe.com/en_US/FlashMed...d56e-7ffd.html немного подкорректировав имею: package { import flash.display.MovieClip; import flash.net.Responder; import flash.net.NetConnection; import flash.events.MouseEvent; import flash.events.NetStatusEvent; import flash.net.ObjectEncoding; import flash.events.AsyncErrorEvent; public class oflaDemo extends MovieClip { private var nc:NetConnection; public var onBWDone; private var myResponder:Responder = new Responder(onReply,onF); public function oflaDemo() { textLbl.text = ""; connectBtn.label = "Connect"; connectBtn.addEventListener(MouseEvent.CLICK, connectHandler); } public function connectHandler(event:MouseEvent):void { if (connectBtn.label == "Connect") { trace("Connecting..."); nc = new NetConnection(); // Connect to the server. nc.objectEncoding = ObjectEncoding.AMF3; nc.client = this; nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus ); nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); nc.connect("rtmp://localhost/oflaDemo",true); // Call the server's client function serverHelloMsg, in HelloWorld.asc. // trace("client: "+nc.client); // trace("onBWDone: " + onBWDone); nc.call("serverHelloMsg", myResponder, "World"); connectBtn.label = "Disconnect"; } else { trace("Disconnecting..."); // Close the connection. nc.close(); connectBtn.label = "Connect"; textLbl.text = ""; } } private function netStatus (event:NetStatusEvent) { trace(event.info.code); } private function asyncErrorHandler(event:AsyncErrorEvent):void{ trace("asynh: " +event); } private function onReply(result:Object):void { trace("onReply received value: " + result); textLbl.text = String(result); } private function onF(result:Object):void { trace("error: "+ result.valueOf()); } } } Connecting... NetConnection.Connect.Success error: [object Object] в логе сервака пишет: 2009-05-05 10:34:41,421 [pool-4-thread-16] ERROR o.r.server.service.ServiceInvoker - Method serverHelloMsg with parameters [World] not found in org.red5.demos.oflaDemo.Application@1495bb8 я так догадываюсь что нужно что-то докалдовывать на java.( Может кто в курсе как выпутаться или сталкивался с подобным, помогите пожалуйста. Добавлено через 6 часов 57 минут капец загнался, для Red5 по ходу функции нужно прописывать в Application на java |
Часовой пояс GMT +4, время: 17:54. |
|
« Предыдущая тема | Следующая тема » |
Теги |
asc , call() , netconnection , red5 |
|
|