Confused about scrolling thumbnail behavior

Used the code in:
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?