Code: Select all
private function GotRooms (event:SFSEvent) {
for (var room in event.params.roomList) {
trace (event.params.roomList [room].getUserList ());
trace (event.params.roomList [room].getUserCount ());
}
}
Code: Select all
private function GotRooms (event:SFSEvent) {
for (var room in event.params.roomList) {
trace (event.params.roomList [room].getUserList ());
trace (event.params.roomList [room].getUserCount ());
}
}
Code: Select all
private function UpdatePlayerBox (room) {
while (playerbox.numChildren > 1) {
playerbox.removeChildAt (1);
}
var userlist:Array = room.getUserList ();
for (var user:String in userlist) {
var playeritem:* = new playeritem_mc ();
playeritem.y = 18.5 * (playerbox.numChildren - 1);
playeritem.playername.text = userlist [user].getName ();
playerbox.addChild (playeritem);
}
}
private function PlayerJoined (event:SFSEvent) {
UpdatePlayerBox (server.getActiveRoom ());
}
private function PlayerLeft (event:SFSEvent) {
UpdatePlayerBox (server.getActiveRoom ());
}
Code: Select all
var room:Room = smartfox.getRoom(smartfox.activeRoomId);
var userList:Array = room.getUserList();Any ideas on what is causing this?TypeError: Error #1009: Cannot access a property or method of a null object reference.
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleUserLeaveRoom()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/xmlReceived()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleSocketData()
TypeError: Error #1088: The markup in the document following the root element must be well-formed.
at it.gotoandplay.smartfoxserver::SmartFoxClient/xmlReceived()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleSocketData()
Code: Select all
// Cycle through all users in the list and add them to the provider
for each(var u:User in room.getUserList())
{
provider.addItem( {label:u.getName(), data:u.getId()} )
}Code: Select all
var userList:Object = roomObj.getUserList()
for ( var i:String in userList )
{
var user:User = userList[ i ]
var uName:String = user.getName()
var uId:Number = user.getId()
if ( uName != myName )
{
var uVars:Object = user.getVariables()
var mc:Avatar = new Avatar
mc.id = "avatar_" + uId
mc.name = "avatar_" + uId
avatarMC.addChild( mc )
mc.x = uVars.px
mc.y = uVars.py
mc.disc.gotoAndStop( uVars.col )
mc.uname.text = uName
}
}That's not the case with this example. Before it threw up a #1009 error, it definitely showed both users in the SFSBits Userlist. So...???As regards the SFSBits UserList the fact that the connected user doesn't show up in the list is just normal. That's the way the component works, it shows all the other users in the Room, not your user.