学了这么多,智商跟我差不多的,概念应该都搞混了
学了就要用。练练吧,做个在线列表,这次没有用ShareObject而是把用户名都装到一个application.onlineList数组里
通过遍历application.clients来广播给各个client,上线下线就是对onlinelist数组的处理。看看吧
[url=http://www.nshen.net/blog/attachments/200603/03_123255_onlinelist.rar]
点此下载[/url]
Client:
btn.onRelease = function() {
if (_root.id.text != "") {
_root.init();
}
};
function init() {
IDNUM = _root.id.text;
//这个为登陆名
//IDPASS = "456";
mync = new NetConnection();
mync.onStatus = function(info) {
trace(info.code);
};
mync.connect("rtmp://localhost/phone", IDNUM, IDPASS);
mync.onlineList = function(list) {
//填充List组件
mylist.labels = list;
};
}
server端
application.onAppStart=function(){
trace("------onAppStart----")
this.onlineList=[]
}
application.onConnect=function(newClient,IDNUM,IDPASS){
trace("------user onconnected------")
newClient.IDNUM=IDNUM
//newClient.IDPASS=IDPASS
//处理在线数组(push)
this.onlineList.push(IDNUM)
this.acceptConnection(newClient);
//广播给client
for(var i=0;i
[最后编辑于 N神, at 2006-03-03 21:57:40]
本文转自:http://www.5uflash.com/flashjiaocheng/Fmsjiaocheng/2282.html