I know about for each loop, but i don't know how to use it in this case.
here's something i tried: http://dl.dropbox.com/u/4322334/array.cap
(use the debugger to see the array values)
I used unique id's to pick objects but it doesn't really work. There is also a bug, if i add behavior to the sprite, every other value in the array appears as zero.