# Problems recognizing the 'end' of an array

**URL:** <https://forum.kirupa.com/t/problems-recognizing-the-end-of-an-array/305909>\
**Category:** flash\
**Created:** [March 5, 2010, 3:52pm UTC](https://forum.kirupa.com/t/problems-recognizing-the-end-of-an-array/305909 "2010-03-05T15:52:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lletdownl](https://avatars.discourse-cdn.com/v4/letter/l/6a8cbe/32.png) [@lletdownl](https://forum.kirupa.com/u/lletdownl)\
**Post date:** [March 5, 2010, 3:52pm UTC](https://forum.kirupa.com/t/problems-recognizing-the-end-of-an-array/305909/1 "2010-03-05T15:52:03Z")

</div>

Hi guys, you have all been very helpful in the past, so im hoping you can help me with this one bit of refinement. here is the code…

```auto
SetNextProject = function () {
	i++;
	ProjectPreloadB(currentArray*);
	if (i>=currentArray.length) {
		_root.mc_projects.mc_projectsLoadedB.mc_arrowF._visible=false;
	} 
	else (_root.mc_projects.mc_projectsLoadedB.mc_arrowF._visible=true)
};

```

The point of this code is to make button mc\_arrowF go away when the end of the array is reached. Its BASICALLY working, however when i load, say currentArray[18], the end of the array, the button doesn’t disappear until i press it again. Basically, the button doesnt disappear until currentArray[19]… even though currentArray.length=18. A

How can i fix this? any help would be appreciated!
