# Problem with Depths - duplicateMovieClip and LoadVars

**URL:** https://forum.kirupa.com/t/problem-with-depths-duplicatemovieclip-and-loadvars/270211
**Category:** flash
**Created:** [September 6, 2008, 5:00pm UTC](https://forum.kirupa.com/t/problem-with-depths-duplicatemovieclip-and-loadvars/270211 "2008-09-06T17:00:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Psykloak1](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@Psykloak1](https://forum.kirupa.com/u/Psykloak1)
#### Post date: [September 6, 2008, 5:00pm UTC](https://forum.kirupa.com/t/problem-with-depths-duplicatemovieclip-and-loadvars/270211/1 "2008-09-06T17:00:27Z")

</div>

Hi.

I’m making something to duplicate a movieclip, and make adjustments to each duplication (setting y, x, scale, etc) based on data from a text file loaded in with LoadVars. Everything works fine, except it’s not setting the depth correctly.

Heres the code (the fla and txt files are also attached)

```auto

var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
    if (success) {
    	for (n=1;n<=this.cnt;n++){
			duplicateMovieClip(_root.item, "item"+n, eval("this.d"+n));
			eval("_root.item"+n)._y=n*10+50;
			
			
trace(eval("this.d"+n));// These two traces should be the same
trace(eval("_root.item"+n).getDepth());// but they're not

		}
    }
};
my_lv.load("contents.txt");

```

The txt file lists the depth as d1=1&d2=2&d3=3&d4=4&d5=5&d6=6&cnt=6

So when the code traces the depth of each duplicated item, it should print out:  
1  
2  
3  
4  
5  
6

Instead it prints out:  
147457  
147458  
147459  
147460  
147461  
147462

If I manually set the depth to 1 - 6, it works, but when I go from the text file, it doesn’t. It doesnt seem to even be using the data from the txt file, I set the contents.txt to: d1=10&d2=20&d3=30&d4=40&d5=50&d6=60&cnt=6 (10,20,30… instead of 1,2,3…) and it still set the depths to 147457, 147458, etc.

Any ideas?
