Reputation: 2473
I have a object e
which has properties like so e.property1, e.property2, e.property3 ...
Now I want to use a for loop to trace all the properties. How can I do that?
Something like this is what I am looking for -
for(var i:int =0; i<10; i++)
{
trace(e.property+i); //how do I get the property no. i
}
Upvotes: 1
Views: 89
Reputation: 1531
for (var i:* in e) trace(i+" :: "+e[i]);
// if they have to be strings just use ...+e[i].toString();
traces
property1 :: test
property2 :: 23.3
property3 :: 29
using fictional values here
Upvotes: 1