Join Room Problem

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

wallis2xk
Posts: 43
Joined: 01 Sep 2006, 10:00
Location: United Kingdom

Join Room Problem

Postby wallis2xk » 06 Nov 2008, 12:37

SFS 1.6.3
AS3


Hi,
In a previous development with AS2 and 1.5.5 I had a structure of a limbo lobby extension which managed users and created and joined users to the dynamic game rooms when they were enough players in the lobby, which worked fine., so for example

Code: Select all

_server.createRoom({name:"Game" + gameCount, maxU:4, isGame:true, xtName:"mgame", xtClass:"mgame.as"}, null, false, false, roomVars, null, false);
if(newRoom != null) {
   var roomId = newRoom.getId();
   var isJoin1 = _server.joinRoom(user1, globalRoomId, true, roomId);
        var isJoin2 = _server.joinRoom(user2, globalRoomId, true, roomId);
}


I'm now trying to do the same thing with AS3 and users still get put to the room fine(checked in the Admin) but, I'm getting client side errors:

Code: Select all

[Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='154' /></body></msg>

[ RECEIVED ]: <cross-domain-policy><allow-access-from domain='*' to-ports='9339' /></cross-domain-policy>, (len: 91)
[ RECEIVED ]: <msg t='sys'><body action='apiOK' r='0'></body></msg>, (len: 53)
[Sending]: <msg t='sys'><body action='login' r='0'><login z='moonminer'><nick><![CDATA[]]></nick><pword><![CDATA[]]></pword></login></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='logOK' r='0'><login n='guest_18' id='20' mod='0'/></body></msg>, (len: 90)
[Sending]: <msg t='sys'><body action='getRmList' r='-1'></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='rmList' r='0'><rmList><rm id='1' priv='0' temp='0' game='0' ucnt='0' lmb='1' maxu='10000' maxs='0'><n><![CDATA[global]]></n></rm></rmList></body></msg>, (len: 178)
[Sending]: <msg t='sys'><body action='autoJoin' r='-1'></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='1'><pid id='0'/><vars /><uLs r='1'></uLs></body></msg>, (len: 92)

[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='196'><pid id='1'/><vars><var n='numPlayers' t='n'><![CDATA[2]]></var></vars><uLs r='196'><u i='20' m='0' s='0' p='1'><n><![CDATA[guest_18]]></n><vars></vars></u></uLs></body></msg>, (len: 218)
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.
Fault, handleJoinOk() at SysHandler.as:231


The problem seems to be that the client-side can't get the room. Is there something different in the way this is done with AS3 or am I missing something else?

Thanks
Richard
orthiac
Posts: 115
Joined: 25 Jun 2008, 10:03
Location: Massachusetts, USA

Postby orthiac » 06 Nov 2008, 13:43

Make sure you are compiling against the new 1.6.3 AS3 API. I just went through the same thing and found I was using the old API.
It's a place to start anyway.

- Mike
wallis2xk
Posts: 43
Joined: 01 Sep 2006, 10:00
Location: United Kingdom

Postby wallis2xk » 06 Nov 2008, 13:56

Thanks, I've double-checked, and yep, I am using the the AS3 1.6.3.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 09 Nov 2008, 14:54

The problem is that the room list of the client is out of synch.
If you take a look at the message dump you have reported you will note that the room list contains only the Limbo room, which is auto-joined.

After that the client receives and update for having successfully joined room with id=196 which was never notified to the client.

I presume you're creating the room on the server side without letting the server notify its creation which in turn causes the problem.
AS 2 would not complain of a method call on a null object, but AS 3 does.

Simply turn on the notification from server side (on the createRoom method), that's the right way to do it.
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 40 guests