hi, i’v little trouble with array:
if i use:
aa= ( aa + 1 ) % aaList.length;
it’s works correctly and when i get last element in array,it returns to frist.
but if i use:
aa= ( aa - 1 ) % aaList.length;
and i’ve the frist element,i get an exception of array.
how to solve?
aa = -1 % num; is an error.
Resort to creating a function like this:
var aaIndex = 0;
var aaArray : Array;
function NextAA(direction : boolean){
direction ? aaIndex++ : aaIndex--;
if(aaIndex < 0) aaIndex = aaArray.length;
if(aaIndex == aaArray.length) aaIndex = 0;
return aaIndex;
}
thank’s,i’ve solved,nice answer 