Quantumwave Interactive Inc.
  Interactive media development . Programming . Design . Consulting

Listing the _global object

The listObj() function recursively list an object and its properties. The ASSetPropFlags() call in this example is used to unhide hidden methods and properties.

Listing the _global object reveals some interesting information. The trace output is fairly long and contains specific information of the system; therefore it is not included here. You can find out by pasting this code into Flash MX and check for yourself.

function tabs() {
   var t = "";
   for (var i = 0; i<listObj.tabs; i++) {
      t += "\t";
   }
   return t;
}

function listObj(o) {
   listObj.tabs++;
   ASSetPropFlags(o, null, 6, true);
   var t = "";
   for (var p in o) {
      var v = o[p];
      switch (typeof v) {
         case "function":
            if (_global[p] != null) t += (tabs()+p+"()"+"\n") + listObj(_global[p]);
            else t += (tabs()+p+"()"+"\n");
            break;
         case "object":
            t += (tabs()+p+"\n") + listObj(v);
            break;
         default:
            t += (tabs()+p+": "+v+"\n");
      }
      if (listObj.tabs < 1) t += "\n";
   }
   t += "\n";
   listObj.tabs--;
   return t;
}

listObj.tabs = -1;

trace(listObj(_global));

Check out other Flash articles here.

Last updated on: May 23, 2002 - Copyright © 2002 Dave Yang / Quantumwave Interactive Inc.

home | about | news | flash | director | shockwave | download | dave | résumé | contact

Copyright © 1995-2009 Quantumwave Interactive Inc.