/ Published in: ActionScript 3

Update: the typeof() function returns 'object' for an array. so there's no need to specifically include it in the switch-case query.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function analyze(_obj):void { var item:Object; switch (typeof(_obj)){ case "object": write("<object>"); write(_obj.toString()); for each (item in _obj){ analyze(item); }; write("</object>"); break; case "xml": write("<xml>"); write(_obj); write("</xml>"); break; default: write(_obj + " (" + typeof(_obj) + ")"); break; }; } // analyze() public function write(_obj):void{ trace(_obj); } // END write()
URL: http://portfolio.artillery.ch/downloads/var_dump-for-as3
Comments
