Nested dynamic text box problem

I’m setting up a drop down menu that will contain dynamic text boxes that allow me to change the names of the various menu items from a text file. Anyways, I can’t seem to get the text box in the slide out movie to use the variable data in the text file. Here’s the code in the main scene –

loadVariablesNum(“names.txt”, 0);
_root.dropdownmov.item1.text = dropdownmov.var4;

“dropdownmov” is the name of the first drop down movie that contains the first set of menu items and is called via telltarget when I roll over a button in the main scene.

“item1” is the instance name for the first menu item button.

“var4” is the variable associated with the item1 button.

The text file contains this line:

&var4=page_info&

I want the first menu item to get the name “page info” from the text file. Any help would be appreciated, beause I’m banging my head against the wall at this point.

Try this:[AS]loadText = new loadVars();
loadText.load(“names.txt”);
loadText.onLoad = function(OK) {
if (OK) {
item1.text = this[“var4”];
} else {
trace(“Error”);
}
};[/AS]

No dice, I tried it in the main movie and in the dropdown movie with no luck. Thanks for trying, hopefully you or others are full of more ideas. I’m just not sure if it’s the paths I’m using or what.

The code i provided passes the value of var4 inside the txt file, to the item1 texfield.
Can you give more details or even post the fla?

*Originally posted by claudio *
**The code i provided passes the value of var4 inside the txt file, to the item1 texfield.
Can you give more details or even post the fla? **

I pasted the code you gave into the actions layer of my main timeline. The dynamic text box that uses var4 resides in the timeline of the dropdownmov. I place the dropdownmov movie in the main timeline. Hold up and I’ll post the fla in a min.

Ok here’s the .fla, its really simple because it’s just a preliminary to figure out what I am supposed to do before I start the website.
Your code is in the main timeline in the actions layer.

Here

Yes, that’s the ticket. So is it this that does the job:

dropdownmov.button_mc.item1.text = this[“var4”];

Would you mind explaining it just briefly, and what I was doing wrong? If you don’t want to it’s no biggie and I thank you very much for your time.

Yes, that line passes the value of var4 to the textfield. I made a few changes. I created a new mc called button_mc and placed the button and texfield inside.

So is the problem just flash being able to see where the text1 instance is? That I didn’t reference the main movie scene correctly in the line:
_root.dropdownmov.text1 = this[“var4”]; because you seemingly get rid of a reference to the main movie by adding another movie clip. Am I on the right track here, or way off?

You werent referencing the textfield correctly. And your texfield was a button. I changed it so the texfield is placed inside a mc with an invisible button.

Ok, fiddling around with your code, I got my original button setup to work correctly and finally take the value. Here is what the code in the actions layer of the main timeline looks like now:

loadText = new loadVars();
loadText.load(“names.txt”);
loadText.onLoad = function(OK) {
if (OK) {
dropdownmov.var4 = this.var4;
} else {
trace(“Error”);
}
};

That takes in the variable and I can keep the button structure I had. Anyways, hats off to you for helping me beat this problem.:beam:

No problema :slight_smile: