Viewing an EsObject
As you probably know by now, one of the coolest ways to pass custom information between the client and the server (and server extension to server extension) is with EsObjects.
While we have been hearing great feedback from the developer community on EsObject it does make debugging a little difficult. If you are programming a Flash client and are using EsObjects in a game or other application you are undoubtedly expecting data to be structured on it in a certain way. If the data isn't there you'll get a run-time error, unless you check for each property before using it.
We just added a toString() method (available in 4.0.4 when released) on the EsObject to allow you to view the data structure at a glance to help with debugging. I can tell you from experience now that having this around for the last few days has saved me loads of time!
Here is an example EsObject and toString() output.
Output:
Here is a more complex output:
While we have been hearing great feedback from the developer community on EsObject it does make debugging a little difficult. If you are programming a Flash client and are using EsObjects in a game or other application you are undoubtedly expecting data to be structured on it in a certain way. If the data isn't there you'll get a run-time error, unless you check for each property before using it.
We just added a toString() method (available in 4.0.4 when released) on the EsObject to allow you to view the data structure at a glance to help with debugging. I can tell you from experience now that having this around for the last few days has saved me loads of time!
Here is an example EsObject and toString() output.
import com.electrotank.electroserver4.esobject.EsObject;
//
var gameMove:EsObject = new EsObject();
gameMove.setString("action", "shoot");
gameMove.setInteger("angle", 45);
gameMove.setInteger("speed", 3);
trace(gameMove);Output:
{EsObject:
action:string = shoot
angle:int = 45
speed:int = 3
}
Here is a more complex output:
{EsObject:
action:string = saveMap
mapName:string = desert
walls:int_array =
[
32,
45,
50,
23,
89,
79
]
info:esobject = {EsObject:
createDate:string = 1/25/08
author:string = Jobe Makar
}
}

THANKS
Post a Comment
<< Home