red5服务器端共享对象
我试图将所有用户存储在服务器端创建的共享对象中,因此所有用户都会获得所有在线用户的同步列表。
我认为我在服务器端正确创建了共享对象,但我无法在 Flash 应用程序中“找到”共享对象。
在 Java Red5 Application 类内部:
ISharedObject userList;
public boolean connect(IConnection conn, IScope scope, Object[] params)
{
if(userList == null)
{
createSharedObject(scope, "userList", false);
userList = getSharedObject(scope, "userList");
}
userList.setAttribute( "user", "some name" );
return true;
}
Flash 共享对象如下所示:
private var _userSO:SharedObject;
private function initUserSO() // I call this function when I get a netConnection
{
_userSO = SharedObject.getRemote("userList", this.uri, false);
_userSO.addEventListener(SyncEvent.SYNC,syncUsers);
_userSO.connect(this); // this = netconnection
}
private function syncUsers(e:SyncEvent):void
{
MonsterDebugger.trace('userManager',_userSO.data);
}
但 _userSO 似乎在服务器上找不到共享对象。
I'm trying to store all the users inside a sharedObject thats created on the server-side, so all the users get a synchronized list of all the online users.
I think I create the sharedObject correct on the server-side but I cant "find" the sharedObject in the flash application.
Inside the Java Red5 Application class:
ISharedObject userList;
public boolean connect(IConnection conn, IScope scope, Object[] params)
{
if(userList == null)
{
createSharedObject(scope, "userList", false);
userList = getSharedObject(scope, "userList");
}
userList.setAttribute( "user", "some name" );
return true;
}
The Flash sharedObject looks like this:
private var _userSO:SharedObject;
private function initUserSO() // I call this function when I get a netConnection
{
_userSO = SharedObject.getRemote("userList", this.uri, false);
_userSO.addEventListener(SyncEvent.SYNC,syncUsers);
_userSO.connect(this); // this = netconnection
}
private function syncUsers(e:SyncEvent):void
{
MonsterDebugger.trace('userManager',_userSO.data);
}
But the _userSO doesn't seem to find the sharedObject on the server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现您可以使用下面的行来执行 as3 脚本,而不是将数据存储在共享对象中:
I found out that you could use the below line to execute as3 script instead of storing the data inside a sharedObject: