Hidden component goodness: ObjectDumper

Get better results with the ObjectDumper! Try this out.

1. Add the DataBindingClasses to your Library (find it in the Classes common library).
2. Add the following ActionScript code to Frame 1 of the Timeline:

import mx.data.binding.ObjectDumper;
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(my_dp);

3. Test the SWF. Your output should be:

[object Object],[object Object],[object Object],[object Object]

Not very helpful.

4. Comment out this: trace(my_dp);

5. Now add the following line to the end of your code:

trace(ObjectDumper.toString(my_dp));

6. Test the SWF again, and marvel at the improved results:
[{avg: 0.279, name: “Grissom, M.”},
{avg: 0.362, name: “Bonds, B.”},
{avg: 0.292, name: “Cruz, D.”},
{avg: 0.327, name: “Snow, J.”}]