FlashBulb
03-05-2008, 06:23 PM
I've had this issue a number of times. When testing code, there are times when I'd like to trace all properties (and more?) of a certain thing in the code.
I use this:
var newObj:Object = {prop1:12, prop2:"as", prop3:true};
for(var i:String in newObj){
trace(i + ": " + newObj[i]);
}
//returns:
//prop1: 12
//prop3: true
//prop2: as
But when I try to use it on some other things, it doesn't work. Isn't EVERYTHING an Object?
For instance, I was looking at some code from the Help - a function (mouseMoveHandler) that takes the parameter 'event:MouseEvent'.
I wanted to see what properties (such as currentTarget) that I could use within MouseEvent, but the loop described above doesn't show me what's available.
Is there another method I can use to search through all properties of things?
I use this:
var newObj:Object = {prop1:12, prop2:"as", prop3:true};
for(var i:String in newObj){
trace(i + ": " + newObj[i]);
}
//returns:
//prop1: 12
//prop3: true
//prop2: as
But when I try to use it on some other things, it doesn't work. Isn't EVERYTHING an Object?
For instance, I was looking at some code from the Help - a function (mouseMoveHandler) that takes the parameter 'event:MouseEvent'.
I wanted to see what properties (such as currentTarget) that I could use within MouseEvent, but the loop described above doesn't show me what's available.
Is there another method I can use to search through all properties of things?