我正在使用 FMS (rtmfp) 连接到网络组。我可以连接到网络组(接收 NetStatusEvent "NetGroup.Connect.Success"),但仅此而已。我无法发布任何内容或看到有人加入了网络组,没有触发 NetStatusEvent。我错过了什么吗?
这是代码:
public function connect(url:String):void {
_nc = new NetConnection();
_nc.client = this;
_nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
_nc.connect(url);
}
private function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code){
case "NetConnection.Connect.Success":
createGroup();
break;
case "NetGroup.Connect.Success":
//post msg to the group
var message:Object = new Object;
message.text = "Hello";
message.sender = _nc.nearID;
_netGroup.post(message);
break;
default:
trace("event.info.code: " + event.info.code);
break;
}
}
private function createGroup():void {
_groupSpecifier = new GroupSpecifier("test_group");
_groupSpecifier.postingEnabled = true;
_groupSpecifier.multicastEnabled = true;
_groupSpecifier.serverChannelEnabled = true;
_netGroup = new NetGroup(_nc, _groupSpecifier.groupspecWithAuthorizations());
_netGroup.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
}