Page 1 of 1

Extension issue

Posted: 28 Mar 2012, 19:52
by kaligus
Hello,

I'm having a problem... a null is returned if I try to send a message from server to my client...look below:

//send("iPadCommand", answer, gameExt.getGameRoom().getUserList()); // THIS DOES NOT WORK
send("iPadCommand", answer, player); //this works

gameExt is my main extension parent. I got this from an example, and it just not work...

This command is inside a handleClientRequest with a class that extends a BaseClientRequestHandler, called in my main extension extended by SFSExtension.

EDIT: I found that getParentRoom() return always null... maybe a bug?
EDIT2: found the problem... but not exacly how to solve it: the getParentRoom() is valid only for Room-level extensions... my extension is in Zone, I thought it will inherit, but it was not (or dont know what)... so I put the following code in my getGameRoom method: return getParentZone().getRoomByName("Lobby"); and it worked...

Re: Extension issue

Posted: 29 Mar 2012, 15:15
by itsmylifesoham
hi,

please clarify this :

is gameExt a zone extension or a room extension?

if its a zone extension then getparentroom() will return null.

now for your solution, lets say its a zone extension. let the zone contain a room named "someroom". also lets say you want to send the message to the users in "someroom".

then do this in your handleclientrequest() :

gameExt .getParentZone().getRoomByName("someroom") instead of gameExt.getGameRoom().getUserList()