home *** CD-ROM | disk | FTP | other *** search
- class Dump
- {
- function Dump()
- {
- }
- static function generateIndent(numSpaces)
- {
- var _loc2_ = "";
- var _loc1_ = 1;
- while(_loc1_ < numSpaces)
- {
- _loc2_ += " ";
- _loc1_ = _loc1_ + 1;
- }
- return _loc2_;
- }
- static function dumpThis(theObject, numSpaces)
- {
- if(numSpaces == undefined)
- {
- numSpaces = 0;
- }
- if(theObject instanceof Array)
- {
- Dump.dumpArray(theObject,numSpaces);
- }
- else if(theObject instanceof Function)
- {
- trace(theObject);
- }
- else if(theObject instanceof Object)
- {
- Dump.dumpObject(theObject,numSpaces);
- }
- else
- {
- trace(theObject);
- }
- }
- static function dumpObject(theObject, numSpaces)
- {
- var _loc3_ = Dump.generateIndent(numSpaces);
- trace(_loc3_ + "Object:");
- for(var _loc4_ in theObject)
- {
- if(theObject[_loc4_] instanceof Object)
- {
- trace(_loc3_ + _loc4_ + ":");
- numSpaces += 4;
- Dump.dumpThis(theObject[_loc4_],numSpaces);
- numSpaces -= 4;
- }
- else
- {
- trace(_loc3_ + _loc4_ + ":" + theObject[_loc4_]);
- }
- }
- }
- static function dumpArray(theObject, numSpaces)
- {
- var _loc3_ = Dump.generateIndent(numSpaces);
- if(theObject[0] != null)
- {
- trace(_loc3_ + "ARRAY:");
- var _loc4_ = theObject.length;
- var _loc5_ = 0;
- while(_loc5_ < _loc4_)
- {
- if(theObject[_loc5_] instanceof Object)
- {
- trace(_loc3_ + "[" + _loc5_ + "]:");
- numSpaces += 4;
- Dump.dumpThis(theObject[_loc5_],numSpaces);
- numSpaces -= 4;
- }
- else
- {
- trace(_loc3_ + "[" + _loc5_ + "]:" + theObject[_loc5_]);
- }
- _loc5_ = _loc5_ + 1;
- }
- }
- else
- {
- trace(_loc3_ + "ASSOCIATIVE ARRAY:");
- for(_loc5_ in theObject)
- {
- if(theObject[_loc5_] instanceof Object)
- {
- trace(_loc3_ + _loc5_ + ":");
- numSpaces += 4;
- Dump.dumpThis(theObject[_loc5_],numSpaces);
- numSpaces -= 4;
- }
- else
- {
- trace(_loc3_ + _loc5_ + ":" + theObject[_loc5_]);
- }
- }
- }
- }
- }
-