# Array with negative indices?

**URL:** <https://forum.kirupa.com/t/array-with-negative-indices/298425>\
**Category:** flash\
**Created:** [October 18, 2009, 10:54pm UTC](https://forum.kirupa.com/t/array-with-negative-indices/298425 "2009-10-18T22:54:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deafdigit](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@deafdigit](https://forum.kirupa.com/u/deafdigit)\
**Post date:** [October 18, 2009, 10:54pm UTC](https://forum.kirupa.com/t/array-with-negative-indices/298425/1 "2009-10-18T22:54:58Z")

</div>

Hi guys,

I have a question regarding arrays.

As far as I know, you can’t refer to an array using negative indices in actionsscript, can you? I know it’s possible in C, C++ and D, but not in actionsscript - to my knowledge. See here’s my problem:

```auto

for (var i = 0; i<menucount; i++) {
	xpos += menuitems[i-1]._width/2+miborder+menuitems*._width/2;
	menuitems*._x = xpos;
}

```

Am I not right in assuming, that this array call produces menuitems[-1] in the first run?

All variables are properly declared - in fact this code works just fine, and I don’t understand that. Could someone please enlighten me?

//deafdigit
