Your Ad Here

Posted By

frankyfish on 04/12/07


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Hirmine
n00ge
bjornredemption


actionscript print_r


 / Published in: ActionScript
 

  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  

You need to login to post a comment.