// --- FCDebug.as --- // /* --------------------------------------------------------------------------------- This file contains the debug functions associated with FusionCharts All the functions contained in this file can be used with any other Flash 5+ movie for debugging/testing The base object in this file is _root.Debug --------------------------------------------------------------------------------- Usage : myDebug = new _root.Debug(objName); myDebug.showObjHierarchy(); --------------------------------------------------------------------------------- */ _root.Debug = function(theObject) { this.theObject = theObject; }; Debug.prototype.showObjHierarchy = function(bUnhide, bDontEnumObjPrototype) { //This function allows to trace out properties of any object/function object recursively. //Setting bUnhide to 'true' exposes the hidden properties using ASSetPropFlags //Setting bDontEnumObjPrototype to 'true' stops it from enumerating objects equal to Object.prototype // such as MovieClip.prototype.__proto__ theObject = this.theObject; var toStr = function (obj, indent) { if (bUnhide) { ASSetPropFlags(obj, null, 6, true); } var count = function (o) { var n = 0;for (var p in o) {n++;}return n;}; var lastProp = count(obj); var s = ""; var i = 0; for (var p in obj) { if (i != 0) { var indent1 = indent; } var pVal = obj[p]; var pType = typeof pVal; if (pType == "string") { s += indent1+p+' : \"'+pVal+'\"'; } else if (pType == "number" || pType == "boolean") { s += indent1+p+' : '+pVal; } else if (p == "constructor" || p == "registerClass" || p == "watch" || p == "unwatch" || p == "addProperty" || p == "valueOf" || p == "toString" || p == "hasOwnProperty" || p == "isPrototypeOf" || p == "apply" || p == "call" || p == "toLocaleString" || p == "isPropertyEnumerable") { s += indent1+p+" : "+pVal; } else if (bDontEnumObjPrototype && pVal == Object.prototype) { s += indent1+p+" : OBJECT PROTOTYPE"; } else { var indent2 = indent; for (var j = 0; j