Loop through array problem

I’m trying to set up this loop to run through the array and add the value of i to each element in the array.
Example: phone.tabIndex=1;
email.tabIndex=2
etc.
[COLOR=orangered]
tabArray = [phone, email, field1, field2, field3, field4, field5, field6, field7, dressBox, subjectBox];
Selection.setFocus(field1);
for (var i = 0; i<tabArray.length; i++) {
tabArray*.tabIndex =*+1;
}
[/COLOR]

When I do a
trace(field7.tabIndex);
it shows up 0
What am I doing wrong. Thanks

did you do
TabArray = New Array(); ?

I’m not sure if you HAVE to declare it, but I’ve had problems if I don’t…

It doesn’t matter if I declare it or not it still doesn’t work.
But on that question of declaring it.


tabArray = [phone, email, field1, field2, field3, field4, field5, field6, field7, dressBox, subjectBox];

Writing out the whole array surely declares the array no. But I still get 0 in the trace().
It’s this part that is wrong.

tabArray*.tabIndex =*+1;

I cant tell what your code should be since it got cut off, but this is what you want.

for (i = 0; i < tabArray.length; i++){
tabArray[**i].tabIndex = i;
}

Gret thanks. That is what I was doing wrong. I was using tabArray*.tabIndex=*;
Thanks again