Hello there!
Here’s a very simple question about a practical issue i have:
if I use the for each method to lookup into an array,
how could I know the index number of the current element WITHOUT using a counter?
With a simple for loop I’d use the increasing var but with a for each?
Here is a practical example, let’s say I want to put all of my sprites one next to each other but i don’t want to use a counter:
for each (var i:Sprite in myArray) {
trace(i) //returns the Sprite
i.x = 100* counter?
}
In the end I wonder if there’s a quick way to return the index of the current looped element. In the Array documentation I couldn’t find anything speaking about this.
I think counters are quite sad to use sometimes (feel like in grammar school).
thanks!