Rhino usuage warning

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
mr_malee
Posts: 29
Joined: 08 Jun 2007, 03:21

Rhino usuage warning

Post by mr_malee »

not sure what it means, didn't seem to break the application, thought you guys might want to know about it:

Image

happened when:

user1 created a game (gameRoom)
user2 joined
game started
user1 left game returned to lobby
user1 requested getRoomStatus call via zone extension.
WARNING!

here's the function inside the zone extension:

Code: Select all

function sendRoomState(user, roomId){
	
	var zone = _server.getCurrentZone();
	var room = zone.getRoom(roomId);
	
	var response = newResponse("getRoomState");
	response.success = false;
	
	if(room != null){

		response.props = room.properties;
		response.roomId = room.getId();
		response.success = true;
	}
	
	_server.sendResponse(response, -1, null, [user], "xml");
}
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Code: Select all

var response = newResponse("getRoomState"); 
newResponse is a typo or what?
If it is new Response(...) ... what object is it?
Lapo
--
gotoAndPlay()
...addicted to flash games
mr_malee
Posts: 29
Joined: 08 Jun 2007, 03:21

Post by mr_malee »

newResponse is just a function I made which returns the most primitive object needed for response (object with a cmd property)

Code: Select all

function newResponse(cmd){
	
	var response = new Object();
	
	response.cmd = cmd;
	
	return response;
}
its just a shortcut.

I think the error might have something to do with the room properties. I'm sending the whole room property object. Maybe I should create a custom roomProp object inside the properties object and send that instead.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

I see,

Code: Select all

response.props = room.properties; 
I didn't notice at first. Yes this can't be done like this.

The properties object is a Java Map and it can't be serialized directly from Actionscript. You should loop through it or add each item manually.
If you have a bit of Java knowledge you can create a function that "unrolls" the properties Map and populates a native AS object
Lapo
--
gotoAndPlay()
...addicted to flash games
mr_malee
Posts: 29
Joined: 08 Jun 2007, 03:21

Post by mr_malee »

ah cool

I don't have any java experience. Manually adding the variables shouldn't be a problem. Thanks for the help :D
Post Reply