# Strange array behaviour- seems to be dumping values

**URL:** https://forum.kirupa.com/t/strange-array-behaviour-seems-to-be-dumping-values/193195
**Category:** flash
**Created:** [July 5, 2006, 3:30am UTC](https://forum.kirupa.com/t/strange-array-behaviour-seems-to-be-dumping-values/193195 "2006-07-05T03:30:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![stunt\_penguin](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@stunt\_penguin](https://forum.kirupa.com/u/stunt_penguin)
#### Post date: [July 5, 2006, 3:30am UTC](https://forum.kirupa.com/t/strange-array-behaviour-seems-to-be-dumping-values/193195/1 "2006-07-05T03:30:04Z")

</div>

Hey guys,

Meet my new app- a WIP flash site that builds it’s nav and content from a DB:

[http://www.chrisdidthis.com/warnerphoto/warnerphoto.html](http://www.chrisdidthis.com/warnerphoto/warnerphoto.html)

I’ve set up a slideshow that runs in loop- it’s not very elegant at the moment, but before I go on working to refine it’s functionality, i’ve run into a problem-

I’m pulling values for my image names from an array of names- I have a value( i ) that increments up and determines the array index to pull the infromation from. This value resets to 0 when it reaches the end of the array and starts from zero again.

Everything works perfectly the first time that \*i \*is climbing towards it’s reset value, however, when i reset it back to 0, the array stops returning values for \*images\_array- it returns _undefined_ for my image names. If you view the link above, you’ll see that the slideshow just _stops_ after it’s cycled through all the images. = |

I’m totally stuck on this one, anyone heard of this before? I’ve pasted in my code here, highlighting the important (i.e not working) bits in black.

Thanks in advance everyone

[COLOR=Silver]++counter;  
if (counter == frequency) {  
counter = 0;  
++loader\_depth;  
loader\_name = “loader\_”+i;  
trace ("changing image, array length = “+images\_array.length+”, i = "+i);  
[COLOR=Black] duplicateMovieClip (image\_loader\_mc, loader\_name, loader\_depth);  
this[loader\_name].image\_name = images\_array\*;  
//  
[/COLOR][COLOR=Black] if ((i+1) == images\_array.length) {  
i = 0;  
}  
++i;[/COLOR]  
}  
gotoAndPlay (2);[/COLOR]

Also, here are my image creation lines that happen a few frames previously- just in case 🙂  
[COLOR=Silver]  
[COLOR=Black]images\_array = new Array ();[/COLOR]  
var frequency:Number = 90;  
var counter:Number = frequency - 5;  
[COLOR=Black]var i:Number = 0;[/COLOR]  
var loader\_depth:Number = 1[/COLOR]
