Copy link to clipboard
Copied
Hello guys, I have searched the forum but couldn't have found appropriate answers. What I'm trying to achieve is to have Flash and AMS create/join/share a common netgroup. However, the basic steps fail - AMS and Flash don't join the same netroup regardless they have the same group specifier. So, I never get the "NetGroup.Neighbor.Connect" because they never join together. Here is my code. "Delegate" class is simply to avoid the "this" context problem
--- AMS ---
load('delegate.asc');
application.onAppStart = function() {
this.gs = new GroupSpecifier('a');
this.gs.multicastEnabled = true;
this.gs.serverChannelEnabled = true;
this.nc = new NetConnection();
this.nc.onStatus = Delegate.create(this, this.onNcStatus);
this.nc.connect('rtmfp://192.168.0.101/multi');
this.ng = null;
};
application.onNcStatus = function(event) {
trace('onNcStatus: ' + event.code);
switch(event.code) {
case 'NetConnection.Connect.Success':
this.ng = new NetGroup(this.nc, this.gs.groupspecWithAuthorizations());
this.ng.onStatus = Delegate.create(this, this.onNgStatus);
break;
}
};
application.onNgStatus = function(event) {
trace('onNgStatus: ' + event.code);
};
--- Flash ---
function onNetStatus(event:NetStatusEvent):void {
trace(event.info.code);
switch(event.info.code) {
case 'NetConnection.Connect.Success':
setupGroup();
break;
}
}
function setupGroup() {
gs = new GroupSpecifier('a');
gs.multicastEnabled = true;
gs.serverChannelEnabled = true;
gs.postingEnabled = true;
ng = new NetGroup(nc, gs.groupspecWithAuthorizations());
ng.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
}
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.connect('rtmfp://192.168.0.101/multi');
Thanks,
S