Hi there,
I need a little help to resolve this in AS 2.0 Flash 8:
I want to load status from a txt file, to retrieve which one of 3 layers should be visible in order to display the status of each of 40 lands to be sell on my a map.
The content of my text file is organized like this:
lot_01_a=false&lot_01_v=true&lot_01_c=false&lot_02 _a=true&lot_02_v=false&lot_02_c=false…
Here is my AS:
myVariables = new LoadVars();
myVariables.load(“terrains.txt”);
myVariables.onLoad = function(success){
if(success){
for (var i = 1; i<41; i++) {
if(i < 10){
trace(“test: “+this[“lot_0”+i+”_a”]); // OK display “test: false” (as example)
trace(“test: “+this[“lot_0”+i+”_v”]); // OK display “test: true” (as example)
trace(“test: “+this[“lot_0”+i+”_c”]); // OK display “test: false” (as example)
// HERE I NEED TO SET MY LAYER VISIBILITY AND IT NEVER WORKS !!!
eval(“lot_0”+i+"_a")._visible = eval(this[“lot_0”+i+"_a"]); // DON’T WORK
eval(“lot_0”+i+"_v")._visible = eval(this[“lot_0”+i+"_v"]); // DON’T WORK
eval(“lot_0”+i+"_c")._visible = eval(this[“lot_0”+i+“c"]); // DON’T WORK
}
else{
// HERE I NEED TO SET MY LAYER VISIBILITY AND IT NEVER WORKS !!!
//set ("lot”+i+"_a.visible", eval(this["lot"+i+“a"])); // DON’T WORK
//set ("lot”+i+"_v.visible", eval(this["lot"+i+“v"])); // DON’T WORK
//set ("lot”+i+"_c.visible", eval(this["lot"+i+“c"])); // DON’T WORK
//setProperty(eval("lot”+i+"_a"), visible, this["lot"+i+“a"]); // DON’T WORK
//setProperty(eval("lot”+i+"_v"), visible, this["lot"+i+“v"]); // DON’T WORK
//setProperty(eval("lot”+i+"_c"), visible, this["lot"+i+“c"]); // DON’T WORK
//eval("lot”+i+"_a").visible = this["lot"+i+“a"]; // DON’T WORK
//eval("lot”+i+"_v").visible = this["lot"+i+“v"]; // DON’T WORK
//eval("lot”+i+"_c").visible = this["lot"+i+“c"]; // DON’T WORK
this["lot”+i+"_a"].visible = this["lot"+i+“a"]; // DON’T WORK
this["lot”+i+"_v"].visible = this["lot"+i+“v"]; // DON’T WORK
this["lot”+i+"_c"].visible = this["lot"+i+"_c"]; // DON’T WORK
}
}
}
else {
trace(“there was a problem loading the variables”);
}
}
As you could see I tried a lot of things without success.
However, the following with hardcoded values works well wich tells me that my instance are correctly named:
eval(“lot_0”+i+"_a")._visible = false; // WORKS !!!
eval(“lot_0”+i+"_a")._visible = true; // WORKS !!!
eval(“lot_0”+i+"_a")._visible = false; // WORKS !!!
Thank’s a lot for helping…:red: