mx.data.binding.ObjectDumper
Tired of using trace and getting [object Object],[object Object],[object Object], etc and then having to write a recursive function to burrow down through the entire object. Jen deHaan (http://www.markme.com/dehaan/) posted up a really cool tidbit on using ObjectDumper.
Article: Hidden component goodness: ObjectDumper
Here’s the code sample from Jen’s blog, with additional info on the other parameters that can be used.
[as]
import mx.data.binding.ObjectDumper;
// create a sample associative array
var my_dp:Array = new Array({name:’Grissom, M.’, avg:0.279}, {name:’Bonds, B.’, avg:0.362}, {name:’Cruz, D.’, avg:0.292}, {name:’Snow, J.’, avg:0.327});
// trace using ObjectDumper.toString
// ObjectDumper.toString(obj, showFunctions:Boolean, showUndefined:Boolean, showXMLstructures:Boolean, maxLineLength:Number, indent:Number)
trace(ObjectDumper.toString(my_dp,false,true,false,80,0));
[/as]
Instead of tracing object Object, … you get a nicely formatted output of the entire object
[{avg: 0.279, name: "Grissom, M."},
{avg: 0.362, name: "Bonds, B."},
{avg: 0.292, name: "Cruz, D."},
{avg: 0.327, name: "Snow, J."}]
Very cool. Super thanks to Jen deHaan for blogging this.


June 1st, 2005 at 12:05 am
Thanks for hosting this John, very very valuable.