"Dump" an Actionscript Custom Object

snipped by pmolaro

In ColdFusion you can "trace" out any variable or object by using the <cfdump> tag. I wanted to do something similar with my Actionscript objects I created for my Flex projects. Below is a nice solution. Be aware I have read that this sometimes crashes your apps with super complicated objects, but I have not encountered that myself.

/* This code assumes you have created an object and populated it with data. 
   Debug your Flex or AIR app to see its contents traced out to the console */
 
import mx.utils.ObjectUtil;
 
trace(ObjectUtil.toString(YOUR_OBJ_NAME));