Of bjorn -
Sent: Tuesday, April 17, 2007 3:18 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Looping through sorted ObjectProxy
Actually, it doesn't ..
If I look in my debugger - this is how the object looks:
obj.stats = Object (@3ff4c81)
[13] = Object (@3ff40c1)
[14] = Object
For..in does not guarantee order. You could theoretically call it twice and
get different results.
You might have to find a way to get an array.
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of bjorn -
Sent: Monday, April 16, 2007 12:06
Thanks for answering Alex. I solved it by adding a sort_order on the server
side and using it for index when creating an Array on the client.
like this:
for each (var value:Object in obj.stats) {
arr[ value.sort_order ] = value;
}
.. I was just puzzled by the fact that it always looked
Actually, it doesn't ..
If I look in my debugger - this is how the object looks:
obj.stats = Object (@3ff4c81)
[13] = Object (@3ff40c1)
[14] = Object (@40333c1)
[15] = Object (@3ec07a1)
[16] = Object (@a973301)
The code:
for( var i:String in obj.stats) {
trace(i);
}
for each
Hey Bjørn,
for in loops in reverse.
for each should give you what you need.
regards,
Bjorn
On 17/04/2007, at 5:11 AM, bjorn - wrote:
I'm getting a sorted ObjectProxy from a server. In my debugger it
looks like this:
obj.stats = Object (@b90e661)
[51] = Object (@b90e541)
[52] =
5 matches
Mail list logo