> For standard arrays, for in.. always goes in reverse order.

I think it is likely to be the reverse order of how the elements were added,
not reverse numerical order of the indices. But please don't count on this
behavior continuing to be supported. Ecmascript doesn't require it, and it
isn't necessarily the most performant implementation.

- Gordon

-----Original Message-----
From: Tracy Spratt [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 7:57 PM
To: [email protected]
Subject: RE: [flexcoders] Re: internal representation of an array



For standard arrays, for in.. always goes in reverse order.  You must
use array.reverse to iterate in the normal order.

Don't know about Associative arrays/objects.
Tracy

-----Original Message-----
From: Eric Raymond [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 7:59 PM
To: [email protected]
Subject: [flexcoders] Re: internal representation of an array



--- In [email protected], Gordon Smith <[EMAIL PROTECTED]> wrote:
> The Flash player implements both Array and Object as hashtables. In 

Two somewhat related questions:

1) How does the implementation work with "for in" loops?  Is there any
natural order in which the propery names are returned?  Does this vary
from an Array to an Object?

2) Is there an "efficient" way to walk a sparsely populated array in
order?  That is if a[2], a[100] and a[2000] are the only elements of
an array, is there a way to visit the three nodes in order without
testing all the "empty" elements between the sparse nodes.

for (var i:Number=2; i < a.length; i++) {
  if (a[i] != undefined) ...
}

If the array elements were created in order of the increasing index,
would that help?  That is, walking the sparse elements in creation
order would suffice in this case.






 
Yahoo! Groups Links



 







 
Yahoo! Groups Links



 





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to