Return to Snippet

Revision: 8159
at November 20, 2008 03:20 by Wiederkehr


Updated Code
public function analyze(_obj):void {
	var item:Object;
	switch (typeof(_obj)){
		case "object":
			write("<object>");
			write(_obj.toString());
			for each (item in _obj){
				analyze(item);
			};
			write("</object>");
		break;
		case "xml":
			write("<xml>");
			write(_obj);
			write("</xml>");
		break;
		default:
			write(_obj + " (" + typeof(_obj) + ")");
		break;
	};
} // analyze()
public function write(_obj):void{
	trace(_obj);
} // END write()

Revision: 8158
at September 4, 2008 18:10 by Wiederkehr


Updated Code
public function analyze(_obj):void {
	var item:Object;
	switch (typeof(_obj)){
		case "array":
			write("<array>");
			write(_obj.toString());
			for each (item in _obj){
				analyze(item);
			};
			write("</array>");
		break;
		case "xml":
			write("<xml>");
			write(_obj);
			write("</xml>");
		break;
		case "object":
			write("<object>");
			write(_obj.toString());
			for each (item in _obj){
				analyze(item);
			};
			write("</object>");
		break;
		default:
			write(_obj + " (" + typeof(_obj) + ")");
		break;
	};
} // analyze()
public function write(_obj):void{
	trace(_obj);
} // END write()

Revision: 8157
at September 4, 2008 18:08 by Wiederkehr


Initial Code
public function analyze(_obj):void {
	var item:Object;
	switch (typeof(_obj)){
		case "array":
			write("<array>");
			write(_obj.toString());
			for each (item in _obj){
				analyze(item);
			};
			write("</array>");
		break;
		case "xml":
			write("<xml>");
			write(_obj);
			write("</xml>");
		break;
		case "object":
			write("<object>");
			write(_obj.toString());
			for each (item in _obj){
				analyze(item);
			};
			write("</object>");
		break;
		default:
			write(_obj + " (" + typeof(_obj) + ")");
		break;
	};
} // analyze()
public function write(_obj):void{
	trace(_obj);
} // END write()

Initial URL
http://portfolio.artillery.ch/downloads/var_dump-for-as3

Initial Description
Update: the typeof() function returns 'object' for an array. so there's no need to specifically include it in the switch-case query.

Initial Title
var_dump() for AS3

Initial Tags

                                

Initial Language
ActionScript 3