# Confused about scrolling thumbnail behavior

**URL:** <https://forum.kirupa.com/t/confused-about-scrolling-thumbnail-behavior/296477>\
**Category:** flash\
**Created:** [September 15, 2009, 3:04pm UTC](https://forum.kirupa.com/t/confused-about-scrolling-thumbnail-behavior/296477 "2009-09-15T15:04:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quasi3](https://avatars.discourse-cdn.com/v4/letter/q/3be4f8/32.png) [@quasi3](https://forum.kirupa.com/u/quasi3)\
**Post date:** [September 15, 2009, 3:04pm UTC](https://forum.kirupa.com/t/confused-about-scrolling-thumbnail-behavior/296477/1 "2009-09-15T15:04:03Z")

</div>

Used the code in:  
[http://www.kirupa.com/developer/mx2004/thumbnails.htm](http://www.kirupa.com/developer/mx2004/thumbnails.htm)  
I modified it to allow for thumbnails of varying widths. I did this by adding a global that held the current size of the scrolling movie clip.  
Original:  
target\_mc.\_x = hit\_left.\_x+(target\_mc.\_width+5)\*k;

Modified:  
target\_mc.\_x = mcWidthGlobal;  
mcWidthGlobal += target\_mc.\_width+5;

with initial value of global being: hit\_left.\_x

This works with a couple of quirks.

1. When I run Test Movie the thumbnails are in reverse order.
2. When I run it from the browser the thumbnails are in a random order that changes each time it’s reloaded.

I added a trace in the function thumbnails\_fn(k) to show the value of k. Though k is incremented with a for loop the trace in the function shows the value starting from the highest and then decreasing.

When I add a trace on i (k’s value in thumbnails\_fn() ) to the for loop in function loadXML(loaded) it increments correctly. So the trace looks like this for 5 thumbs:

1 2 3 4 5 5 4 3 2 1

I am completely confused about this behavior. Can anyone explain this to me?
