# My pictures aren't lining up but the code is right I think?

**URL:** <https://forum.kirupa.com/t/my-pictures-arent-lining-up-but-the-code-is-right-i-think/193192>\
**Category:** Uncategorized\
**Created:** [July 5, 2006, 2:42am UTC](https://forum.kirupa.com/t/my-pictures-arent-lining-up-but-the-code-is-right-i-think/193192 "2006-07-05T02:42:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmashburn](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jmashburn](https://forum.kirupa.com/u/jmashburn)\
**Post date:** [July 5, 2006, 2:42am UTC](https://forum.kirupa.com/t/my-pictures-arent-lining-up-but-the-code-is-right-i-think/193192/1 "2006-07-05T02:42:16Z")

</div>

Well, obviously the code can’t be right… but it looks right to me…

```auto
function thumbnails_fn(k) { 

thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth()); 
tlistener = new Object(); 
tlistener.onLoadInit = function(target_mc) { trace (k);
target_mc._x = hit_left._x + (eval("thumbnail_mc.t" + k)._width);
trace (target_mc._x);
trace(eval("thumbnail_mc.t" + k));
//target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k; 

```

this is just a piece of the code… but this is where the error is happening…

If I remove :

```auto
tlistener = new Object(); 
tlistener.onLoadInit = function(target_mc) { trace (k);

```

and I trace(k)… it comes out 0, 1, 2, 3, 4, 5, 6… which it should… but when I have that code in it, the numbers out come out all random…

The problem is here:

```auto
target_mc._x = hit_left._x + (eval("thumbnail_mc.t" + k)._width);

```

it creates new thumbnail\_mc’s on load according to how many are in the XML file its reading them from. they are like thumbnail\_mc.t1, t2, t3 etc… k represents the numbers.

Anyway… that code should mean

target\_mc.\_x = 0 + width of the first image…

When i trace the (eval(“thumbnail\_mc.t” + k).\_width) … the width is definitely correct for each thumbnail… but the target\_mc.\_x doesn’t put it there for some reason??

they all become jumbled up in around the same spot…

Anyone know why?

Where I got the code… [http://www.kirupa.com/developer/mx2004/thumbnails.htm](http://www.kirupa.com/developer/mx2004/thumbnails.htm)

hellp! 🙂
