FLASH COM服务器端SharedObject的问题

      FLASH COM 2005-8-25 10:13
前两天在做一个FLASH COM的项目,我想在服务器端创建一个SharedObject(后面简称SO),用来存放用户信息,为了能够在客户端直接取得每个用户的ID和其它的更多信息,我就在SO里面用对象的形式存,每个用户信息是一个对象,里面有若干属性,对应一个用户的不同信息如用户名、userID……等。客户端则与这个SO连接
但这样一来,问题就来了,当只有一个用户登陆的时候是没问题的,客户端只触发一次onSync,但当第二个用户登陆后,会不停的触发onSync,如果我把OS的信息改用变量,而不是Object,就不会出现这种情况,但这样一来,就只能存贮很少的用户资料了。
以下是部分代码
服务器端:
//当FLASHCOM应用开始时执行...
application.onAppStart=function()
{
    this.userId = 0;

    this.onlineUsers = new Object();
    this.userLink = new Array();
    this.users_so=SharedObject.get("users", false)
    this.users_so.clear();
}
//当连接FLASHCOM应用时执行...
application.onConnect=function(newClient,userName)
{
    this.acceptConnection(newClient);
    this.userId++
    newClient.userId=this.userId;
    newClient.myRoom = 0;
    newClient.userName=userName
    //
    var s = this.userId.toString();
    this.onlineUsers[s] = newClient;
    this.userLink.push(s);
    //初始化在线用户信息
    var user_obj=new Object();
    user_obj.label=newClient.userName
    user_obj.userId=newClient.userId
    user_obj.room=newClient.myRoom
    this.users_so.setProperty("users"+newClient.userId, user_obj);
……
}
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}