Even if it iterates backwards, I don't think I'd trust it.  I don't
like the idea of relying on an implementation detail of the for-in
loop in order to make my stuff work.  In general I see  for-in loops
(any language) as loops that use an arbitrary ordering, and as such
you shouldn't rely on any particular ordering for your code to work.
I tend to think it's safer to approach things this way, as it protects
you from any changes in the implementation details.  Just the fact
that you're "Not sure about AS3" is reason enough I think.

But maybe I'm just paranoid. :)

  -Andy

On 12/21/06, T. Michael Keesey <[EMAIL PROTECTED]> wrote:
No, because it's a for (x in a) loop, not a for (x; y; z) loop. In AS2
it iterates backwards over the elements. Not sure about AS3, but it
should work there, too. Try it and see!

On 12/21/06, Andy Herrman <[EMAIL PROTECTED]> wrote:
> Wouldn't doing the splice there change the indexes of everything else
> in the array and mess up the loop?
>
> For instance:
>
> [1, 2, A, A, 5, A, 7]
>
> say you're deleting the As.
>
> The first time you do a splice you remove the first one, and get:
>
> [1, 2, A, 5, A, 7]
>
> The index of everything after the first A has now changed.  The second
> one is now at index 3, but you already handled index 3 in the for
> loop.  Is the for-in loop smart enough to run index 3 again, since the
> value there is new?
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to