# Dynamically loading text, only more complex

**URL:** <https://forum.kirupa.com/t/dynamically-loading-text-only-more-complex/12073>\
**Category:** flash\
**Created:** [January 26, 2003, 2:08pm UTC](https://forum.kirupa.com/t/dynamically-loading-text-only-more-complex/12073 "2003-01-26T14:08:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Llyd](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@Llyd](https://forum.kirupa.com/u/Llyd)\
**Post date:** [January 26, 2003, 2:08pm UTC](https://forum.kirupa.com/t/dynamically-loading-text-only-more-complex/12073/1 "2003-01-26T14:08:08Z")

</div>

Depending which button is pressed in a menu, I want to dynamically load different text from a text file into the same movie clip \> text box.

That is, I do not want to have to create duplicated movie clip instances, each linked to a different button, in order to achieve this.

Im guessing there will need to be some code in the movie clip similar to the following…

“if button pressed = news, then load news.text into text box  
else if button pressed = about, then load about.text into textbox”

etc.

Im sure it’s possible, but my actionscript skills arent yet that advanced…

Any ideas?

---

<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:** [January 26, 2003, 7:44pm UTC](https://forum.kirupa.com/t/dynamically-loading-text-only-more-complex/12073/2 "2003-01-26T19:44:44Z")

</div>

just have eash action for each button seperate. Each button shouldnt run the same code (well its not that they shouldnt, but rather often dont) and then go through the same if/else clause for determining which button it is. Just have each button load the text in

button1.onRelease = function(){  
someMovieClip.loadVariables(“text1.txt”);  
}  
button2.onRelease = function(){  
someMovieClip.loadVariables(“text2.txt”);  
}  
…

where the text variable in the .txt files are the same as the variable name (not instance name) of the textfield in the someMovieClip

---

<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:** [January 26, 2003, 7:49pm UTC](https://forum.kirupa.com/t/dynamically-loading-text-only-more-complex/12073/3 "2003-01-26T19:49:20Z")

</div>

yup. Already worked it out. I should try spending a little more time thinking before I ask simple questions…

Thanks all the same!! 🙂
