home *** CD-ROM | disk | FTP | other *** search
/ FCE Gold Plus / GOLD.iso / pc / main.swf / scripts / __Packages / Dump.as next >
Text File  |  2007-11-02  |  3KB  |  103 lines

  1. class Dump
  2. {
  3.    function Dump()
  4.    {
  5.    }
  6.    static function generateIndent(numSpaces)
  7.    {
  8.       var _loc2_ = "";
  9.       var _loc1_ = 1;
  10.       while(_loc1_ < numSpaces)
  11.       {
  12.          _loc2_ += " ";
  13.          _loc1_ = _loc1_ + 1;
  14.       }
  15.       return _loc2_;
  16.    }
  17.    static function dumpThis(theObject, numSpaces)
  18.    {
  19.       if(numSpaces == undefined)
  20.       {
  21.          numSpaces = 0;
  22.       }
  23.       if(theObject instanceof Array)
  24.       {
  25.          Dump.dumpArray(theObject,numSpaces);
  26.       }
  27.       else if(theObject instanceof Function)
  28.       {
  29.          trace(theObject);
  30.       }
  31.       else if(theObject instanceof Object)
  32.       {
  33.          Dump.dumpObject(theObject,numSpaces);
  34.       }
  35.       else
  36.       {
  37.          trace(theObject);
  38.       }
  39.    }
  40.    static function dumpObject(theObject, numSpaces)
  41.    {
  42.       var _loc3_ = Dump.generateIndent(numSpaces);
  43.       trace(_loc3_ + "Object:");
  44.       for(var _loc4_ in theObject)
  45.       {
  46.          if(theObject[_loc4_] instanceof Object)
  47.          {
  48.             trace(_loc3_ + _loc4_ + ":");
  49.             numSpaces += 4;
  50.             Dump.dumpThis(theObject[_loc4_],numSpaces);
  51.             numSpaces -= 4;
  52.          }
  53.          else
  54.          {
  55.             trace(_loc3_ + _loc4_ + ":" + theObject[_loc4_]);
  56.          }
  57.       }
  58.    }
  59.    static function dumpArray(theObject, numSpaces)
  60.    {
  61.       var _loc3_ = Dump.generateIndent(numSpaces);
  62.       if(theObject[0] != null)
  63.       {
  64.          trace(_loc3_ + "ARRAY:");
  65.          var _loc4_ = theObject.length;
  66.          var _loc5_ = 0;
  67.          while(_loc5_ < _loc4_)
  68.          {
  69.             if(theObject[_loc5_] instanceof Object)
  70.             {
  71.                trace(_loc3_ + "[" + _loc5_ + "]:");
  72.                numSpaces += 4;
  73.                Dump.dumpThis(theObject[_loc5_],numSpaces);
  74.                numSpaces -= 4;
  75.             }
  76.             else
  77.             {
  78.                trace(_loc3_ + "[" + _loc5_ + "]:" + theObject[_loc5_]);
  79.             }
  80.             _loc5_ = _loc5_ + 1;
  81.          }
  82.       }
  83.       else
  84.       {
  85.          trace(_loc3_ + "ASSOCIATIVE ARRAY:");
  86.          for(_loc5_ in theObject)
  87.          {
  88.             if(theObject[_loc5_] instanceof Object)
  89.             {
  90.                trace(_loc3_ + _loc5_ + ":");
  91.                numSpaces += 4;
  92.                Dump.dumpThis(theObject[_loc5_],numSpaces);
  93.                numSpaces -= 4;
  94.             }
  95.             else
  96.             {
  97.                trace(_loc3_ + _loc5_ + ":" + theObject[_loc5_]);
  98.             }
  99.          }
  100.       }
  101.    }
  102. }
  103.