Need help with text file tutorial on this site

I have successfully managed to finish the tutorial covering text files, but I cannot get it to work with my own scenario:

I have 1 movie that acts as a photo gallery, loading up pictures based on navigation buttons or user input. I am attempting to add captions to each picture by using a dynamic text box, and having it filled in with values from the text file. I will worry about the navigation aspect of this later, but for right now I cannot seem to get the text to show up on my movie. I have checked the font and that is a different color than the background, and it is on its own layer. Here is how things are set up:

Dynamic Text Box:
Instance name (also tried var) = mycaption

Text file:
“mycaption.txt”
values:
caption=this is a test

Actionscript:
[AS]
//loads in the caption for each picture
loadText = new loadVars();
loadText.load(“mycaption.txt”);
loadText.onLoad = function() {
caption.text = this.mycaption;
}[/AS]
Again, when I test the movie in either flash or the web, I cannot see any text in the text box.
Thanks for any and all help!!

Post the fla

I aint to sure but…
Is the text file in the same directory as your SWF File.
What i mean is that is your "mycaption.txt in the same Folder as your SWF File.
Same goes with Website make sure you upload both of them.

well crap… It is too big to upload here, even by zipping it… I need to shrink the size of the bg graphic… anywho, you can download and look at it here

It is easy to overlook the obvious! I did double-check to make sure the file was in the right place in both instances, and it appears to be.

[AS]loadText = new loadVars();
loadText.load(“mycaption.txt”);
loadText.onLoad = function() {
caption.text = this.mycaption;
}
[/AS] Should be:[AS]loadText = new loadVars();
loadText.load(“mycaption.txt”);
loadText.onLoad = function() {
captions.text = this.caption;
}
[/AS][edit]assuming your textfield has an instance name of captions and your txt variable is caption.[/edit]

ok, changed those, but no luck yet…

Nice Call claudio

ahhh! it worked! thank you so much… I will tinker around with it to see if I can make it change with the nav buttons… Any suggestions on where to start?

It should work.
Make sure your txt file is named mycaption.txt, your variable inside the txt file is caption=blablabla and you textfield instance name is captions

Yeah, sorry about that at first, posted that before you had time to edit.

You want each photo a different caption? Load 1 txt file with all the variables for each picture and update the textfield with the new variable.

How would I seperate them in the text file?
caption1=
caption2=
? is there some delimiter I need to stick in there?

caption1=blabla&caption=blabla&caption3=blabla&

use & to separate them

Cool, I will give that a shot… Thanks again!

No problema
:wink:

I hope I don’t bother you with all my n00b questions, but I have run into another stumbling block… Using this code:
//loads in the caption for each picture
[AS]loadText = new loadVars();
loadText.load(“mycaption.txt”);
loadText.onLoad = function() {
captions.text = this.caption1;[/AS]
This works fine, but I want to assign a variable called “whichcap” that will be an integer. My problem is that I don’t know how to add the variable into the last line… I have tried:
captions.text = this.caption1+whichcap, but it only displays a zero…

I didnt understand what you trying to do :-\

heh… let me try again… I have a collection of pictures that are in different categories (camping, concerts, etc). For the sake of the viewer to the website, I would like to have a text box with a caption explaining each picture. The problem is, I can get it to pull from the text file, but not while I navigate the pictures (1-15). I would like to have a caption load up with the first picture, and then change to a different caption as I navigate the pictures… Clear as mud? :wink:

I think i got it…