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)
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?