我是ActionScript 3的新手。我正在尝试使用nc.call()方法从客户端调用服务器,看看这是否是客户端在聊天应用程序中来回通信的好方法。
我收到一条编译错误消息:
1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.net:Responder.有没有人能帮我解决这个错误?
下面是我的客户端代码:
import flash.net.NetConnection;
import flash.events.NetStatusEvent;
var nc:NetConnection = new NetConnection();
nc.connect("rtmfp:/fms/textchatexample");
nc.addEventListener(NetStatusEvent.NET_STATUS, netHandler);
function netHandler(event:NetStatusEvent):void {
switch(event.info.code) {
case "NetConnection.Connect.Success":
trace("Your Connected UP");
break;
}
}
var test:Object = new Object();
test.onResult = function(arg) {
trace(arg);
};
nc.call("sendMsg", test, "just, a test call"); ERROR LINE发布于 2013-02-21 23:32:08
尝试用Responder替换您的Object实例
var test:Responder = new Responder(
function(result):void
{
trace('ok :', result);
},
function(status):void
{
trace('status :', status);
});而不是你的Object
https://stackoverflow.com/questions/14939365
复制相似问题