for (var i:String in myArray)
{
if (myArray[i] == value)
return Number(i);
}
using a for..i..in loop will always be faster. Even more then --a -(-1)
iteration. Unless you can guarentee that your element will always be near
the beginning of a large array, as the for..i..in starts from the back. I
recommend using this loop anywhere you need the most speed and order doesn't
matter, as in this case.
Tyler
On 9/19/06, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote:
I guess what it depends on is what you're doing with that for loop.
If you're using it to attach or create or animate movieclips, or parse
through xml or a recordset, or anything that would make Flash
unresponsive during the loop, then the benefits of while (--a -(-1))
outweigh the readability compared to while (a--).
As a result, I use it pretty often. ;)
So, now I just end up using it for everything since it's become a habit.
The flipside is that sometimes I need to do forward loops for
reiterating to maintain proper order. However, I would have to do that
anyway regardless of which backwards looping method I used.
_______________________________________________
[email protected]
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
_______________________________________________
[email protected]
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