# Need help with text file tutorial on this site

**URL:** https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332
**Category:** flash
**Created:** [July 11, 2003, 3:57pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332 "2003-07-11T15:57:10Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![bbender21](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bbender21](https://forum.kirupa.com/u/bbender21)
#### Post date: [July 11, 2003, 3:57pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/1 "2003-07-11T15:57:10Z")

</div>

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!!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:06pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/2 "2003-07-11T16:06:21Z")

</div>

Post the fla

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:09pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/3 "2003-07-11T16:09:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:16pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/4 "2003-07-11T16:16:16Z")

</div>

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](http://www.cfyouth.com/pub/load_images.fla)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:17pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/5 "2003-07-11T16:17:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:22pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/6 "2003-07-11T16:22:21Z")

</div>

[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]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:26pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/7 "2003-07-11T16:26:49Z")

</div>

ok, changed those, but no luck yet…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:27pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/8 "2003-07-11T16:27:02Z")

</div>

Nice Call claudio

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:29pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/9 "2003-07-11T16:29:03Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:29pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/10 "2003-07-11T16:29:32Z")

</div>

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**

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:30pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/11 "2003-07-11T16:30:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:30pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/12 "2003-07-11T16:30:38Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:32pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/13 "2003-07-11T16:32:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:34pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/14 "2003-07-11T16:34:20Z")

</div>

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

use & to separate them

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:34pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/15 "2003-07-11T16:34:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:35pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/16 "2003-07-11T16:35:29Z")

</div>

No problema  
😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 4:57pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/17 "2003-07-11T16:57:55Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 6:42pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/18 "2003-07-11T18:42:21Z")

</div>

I didnt understand what you trying to do :-\

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 6:46pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/19 "2003-07-11T18:46:07Z")

</div>

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? 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2003, 7:30pm UTC](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332/20 "2003-07-11T19:30:19Z")

</div>

I think i got it…

[Next page](https://forum.kirupa.com/t/need-help-with-text-file-tutorial-on-this-site/25332.md?page=2)
