Is this what your looking for? It has it's limitations, would be nice if there was a myObj.toString() == "myObj".. Or something
along those lines :)



var myObj:Object = new Object;
var s:String = "";

s = getMyObjectName(myObj);
trace(s);
this[s].anyName = "text";
trace(myObj.anyName);

function getMyObjectName(obj):String {
   for (i in this) {
       if (this[i] == obj) return i;    // Should it be ===?
   }
}



----- Original Message ----- From: "Sascha Balkau" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Monday, January 23, 2006 12:19 PM
Subject: Re: [Flashcoders] getting the name of an object


Modifying a debug tool and thought there could be some way to trace out the name of an object that is being traced recursively instead of having just [Object] [object] before it. Not that this is necessary, it would be just a 'nice to have' option.

Thanks for help and explanation all!
-Sascha


----- Original Message ----- From: "Morten Barklund Shockwaved" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Monday, January 23, 2006 11:23 PM
Subject: Re: [Flashcoders] getting the name of an object


Couldn't you rather explain, what you were trying to accomplish - then maybe we could understand and help?

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to