View Full Version : "num" assigned with LoadVars()?
bchalker
02-17-2004, 01:13 PM
I've got a loop and dupMC() using "num" as their values and am wanting the LoadVars() text file (menuLoad) that my nav loads to contain the value for "num" - then execute dupMC() based on it.
I put:
this["num"]=menuLoad["num"];
into a loop, but it will not work.
Am I doing something wrong, or is it not possible?
thanks
this["num"] basically evaluates to this.num
same with menuLoad["num].
so do you have variables this.num and menuLoad.num?
bchalker
02-17-2004, 01:24 PM
Thanks tg,
Actually, it's now working (at least trace(num) shows correctly), but is still not using the value (12) in my executed dupMC().
whats your loop look like?
bchalker
02-17-2004, 01:27 PM
for (n=0;n<num;n++) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*15);
this["b" + n].demoTitle.demoTitle = n ;
}
for(var n=0;n<num;n++){
this.b.duplicateMovieClip("b"+n,n);
this["b"+n]._y=ystart+n*15;
this["b"+n].demoTitle.demoTitle=n;
}
the loop looks correct, check your path to demoTitle.demoTitle.. maybe something is messed up there
bchalker
02-17-2004, 01:55 PM
Thanks...no, the path is correct, and shows the values ("b") properly.
Here is the script:
function labelLoad(num){
setProperty("b", _visible, 0);
ystart = b._y;
for (n=0;n<num;n++) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*15);
this["b"+n].demoTitle.demoTitle=n;
}
for (i=0;i<50;i++){
this["b"+i].onRollOver=btOver;
this["b"+i].onRollOut=btOut;
}
}
menuLoad=new LoadVars();
menuLoad.load("test.txt");
menuLoad.onLoad = function(success){
num=menuLoad["num"];
labelLoad(num);
trace(num)
}
thanks for the help so far tg :)
try this:
num=Number(menuLoad["num"]);
my guess is that num is the string "12", not the number 12, so its hosing your loop.
bchalker
02-17-2004, 02:18 PM
Thanks, but still not working - though I had forgotten about the string thing. I'm going to go back over it a few times :)
stick a few traces inside your loop and see what you get...
trace(n);
trace(this["b"+n]);
etc.
|
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.