Return to Snippet

Revision: 25007
at March 17, 2010 15:10 by frankyfish


Initial Code
function print_r(theObj,indent=""):String {
	var output="";
	if (indent == "") { indent = "    "; } else { indent += "    "; }
	var type = (theObj.constructor == Array) ? "Array" : "Object";
	output += "("+type+")=>\n";
	if(theObj.constructor == Array || theObj.constructor == Object) {
		for(var p in theObj){
			if(theObj[p].constructor == Array|| theObj[p].constructor == Object){
				output += indent+"["+p+"]";
				output += print_r(theObj[p],indent);
			} else { output += indent+"["+p+"]:"+theObj[p]+"\n"; }
		}
	}
	return output;
}

Initial URL


Initial Description


Initial Title
ActionScript 3 print_r

Initial Tags
object, array

Initial Language
ActionScript 3