Another dynamic text problem

I’ve loaded a text file with my variables in it, and am trying to make buttons change the content of text box to one of my several variables… basicly each button corresponds to a variable that should display a text string.

Can’t get the button to load the variable, when clicked the box displays “undefined”.

Any help would be great.

**All I really need is a code chunk for the variable loading (which I have) and for the individual button (which is where my problem lies)

post code samples in the future, makes it much easier to assess where your problem is

what code are you using on the button currently?

Part of the problem is that I have no idea what code to use on the button… I have this in my actions layer:

 unique = new Date().getTime();
loadMain = new LoadVars();
loadMain.load("data/locations.txt?unique="+unique);
loadMain.onLoad = function(success) {
 if (success) {
  locations.htmlText = this.main;
 } else {
  locations.htmlText = "Error loading data";
 }
}; 

and then the code on one of my buttons in my other layer is:

 on (release) {
 locations.htmlText = this.location1;
} 

and it doesnt work, I also tried putting the whole load variables thing onto the button as a test, but that didnt work either.

Shameless bump

Sorry, I really need help with this.

You are passing parameters to a text file? what is the use of that part?

No, I’m loading a text file and displaying text strings within it. I want my buttons to change which string is displayed.

really not sure what to tell you on that one … i’m confused as to what this.main refers to. is that the name of a variable or what?

i’ve had problems in the past setting this.htmlText you may try using this.text first just to get it to load then worry about formatting it.

without seeing the rest of the file and only looking at this script i’d say the problem is that you’ve loaded vars into a variable called loadMain then you said the text should = main … two different variable names, unless you have that specified as a variable somewhere in the text file you’ve loaded