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 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Looping through sorted ObjectProxy



I'm getting a sorted ObjectProxy from a server. In my debugger it looks like 
this:
 
obj.stats = Object (@b90e661)
 [51] = Object (@b90e541)
 [52] = Object (@b90e361)
 [1] = Object (@b90e121)
 [2] = Object (@b90e9e1)
 
(its week numbers linked to Objects, btw).
 
However, when I use for() like this:
 
for( var i:String in obj.stats) {
      trace(obj.stats[i])
}
 
.. i get them in a different order (it starts with 2, then goes back to 51).
 
Why does for() behave this way? .. and how can I loop through them in the order 
I see in my debugger?
 
Best regards,
Bjørn
-- 

========================
http://www.juicability.com <http://www.juicability.com>  - flex blog
http://www.43min.com <http://www.43min.com>  - funny movies 

 

Reply via email to