Button._visible with LoadVars

I’m working on a site that has dynamically loaded text menu loaded with the following action:

myData = new LoadVars();
myData.load(“menu/menu01.txt”);
myData.ref = this;
myData.onLoad = function(succes) {
if (succes) {
for (var i = 0; i<this.cant; i++) {
this.ref[“title_txt”+i].htmlText = this[“Title”+i];
this.ref[“link”+i].htmlText = this[“link”+i];
}
} else {
trace(“Error loading data”);
}
};

which loads this text from menu/menu01.txt:

Title0=TITLE HERE &link0=FIRST LINK&link1=SECOND LINK&link2=&link3=&link4=&link5=&link6=&link7=&link8=&link9=&link10=&link11=&link 12=&link13=&link14=&cant=15

what i would like to know, since this is new to me, is can i have a button instance on the stage under each variable from menu01.txt, and set the buttons to _visible=true; or _visible=false; depending on wether or not there was text loaded in the dynamic text field? also, how can i get flash to recognize wether or not text was loaded or not loaded if the var is empty?

thanks.

you need 4 frames
// frame 1
for(i= 1 to n)
linkN._visible = false;
// frame 2
myData = new LoadVars(); …
// frame 3
for(i= 1 to n)
if( myData.linkN != “”)
btnLinkN._visible = true;

this is not exact code but pseudocode. just to give you the idea.

happy actionscripting

not sure i follow you. in particular the “n” here: (i= 1 to n) and what the LinkN represents. Can anyone help me out with a little more of a hint?

You could try writing a conditional to test if the text field has anything in it at all. For example.

if(mytext_txt.text !=""){
mymc_mc._visible=true
}else{
mymc_mc._visible=false
}

That may or may not be what you’re lookin for. Either way, hope it helps.

linkN means link + N

this.ref[“title_txt”+i].htmlText = this[“Title”+i];
this.ref[“link”+i].htmlText = this[“link”+i];

in your case this.ref[“title_txt”+i] this.ref[“title_txt”+N].