actionscript print_r


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. print_r = function(theObj,indent){
  2. var output=String(theObj)+"\n";
  3. if (indent == undefined) { indent = " "; } else { indent += " "; }
  4. if(theObj.constructor == Array || theObj.constructor == Object) {
  5. for(var p in theObj){
  6. if(theObj[p].constructor == Array|| theObj[p].constructor == Object){
  7. var type = (theObj[p].constructor == Array) ? "Array" : "Object";
  8. output += indent+"["+p+"]("+type+")=>\n";
  9. output += print_r(theObj[p],indent);
  10. } else { output += indent+"["+p+"]:"+theObj[p]+"\n"; }
  11. }
  12. }
  13. trace(output);
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.