# Accessing next/previous items in array

**URL:** <https://forum.kirupa.com/t/accessing-next-previous-items-in-array/149244>\
**Category:** flash\
**Created:** [May 27, 2005, 4:46am UTC](https://forum.kirupa.com/t/accessing-next-previous-items-in-array/149244 "2005-05-27T04:46:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hgfl](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@hgfl](https://forum.kirupa.com/u/hgfl)\
**Post date:** [May 27, 2005, 4:46am UTC](https://forum.kirupa.com/t/accessing-next-previous-items-in-array/149244/1 "2005-05-27T04:46:34Z")

</div>

This is probably something very simple, but I’m not too sure of the code used to access items within an array.

Suppose I have an array like this (using Kirupa’s Arrays example):

[font=Courier New][color=#0033cc]grocery = [“bananas”, “oranges”, “apples”, “kiwis”];  
trace(grocery);[/color][/font]  
[font=Courier New][color=black][/color][/font]  
[font=Courier New]And we’ve loaded up the corresponding variables/text for “bananas”, thus the current item = bananas.[/font]  
[font=Courier New]Therefore the next item would be “oranges”. How can I tell Flash that I want to access this next item?? (I’d like to be able to access it through a variable so that the same action can be applied when the item is “oranges” to move to the next item, which would now be “apples”). Thanx[/font]
