# Dynamic, changing text

**URL:** <https://forum.kirupa.com/t/dynamic-changing-text/4770>\
**Category:** flash\
**Created:** [August 19, 2002, 7:51pm UTC](https://forum.kirupa.com/t/dynamic-changing-text/4770 "2002-08-19T19:51:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marnie](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@marnie](https://forum.kirupa.com/u/marnie)\
**Post date:** [August 19, 2002, 7:51pm UTC](https://forum.kirupa.com/t/dynamic-changing-text/4770/1 "2002-08-19T19:51:16Z")

</div>

I am trying to create a image gallery with captions.

I have a text box on a MC, my images on a separate MC, and my buttons on another.

I can load a single text file into the text box, using the buttons, with a load variable action.

however i am lost as to how to load a different text file into the same text box from a different button.

IE. button 1 loads text 1 in textbox ‘caps’  
Button 2 loads text 2 in textbox ‘caps’

My solution is to have all my text as separate MC’s on the text box and each button does a tell target.

My scripting on a scale of 10 is 2  
Pls 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:** [August 19, 2002, 9:03pm UTC](https://forum.kirupa.com/t/dynamic-changing-text/4770/2 "2002-08-19T21:03:34Z")

</div>

you buttons code should look something like this:

button1:

on(release){  
\_root.caps=“text1 goes here”;  
}

button2:

on(release){  
\_root.caps=“text2 goes here”;  
}

button3:

on(release){  
\_root.caps=“text3 goes here”;  
}

This code assumes that your textbox is on the root and that in properties panel for the textbox, in the var section, you’ve put the variable name “caps” (without quotes).

---

<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:** [August 21, 2002, 5:26pm UTC](https://forum.kirupa.com/t/dynamic-changing-text/4770/3 "2002-08-21T17:26:57Z")

</div>

Sorry for the slow response, my Internet connection had probs

That works, I can put the text into the action, much better than the movie clips.

I didn’t know it could be done so simply.

I did however want the buttons to load the text from external files, but at the moment i am in no position to dog a working solution.

If it is relatively simple or doesn’t take major con’script’ion i wouldn’t mind

Thanks for the 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:** [August 21, 2002, 7:39pm UTC](https://forum.kirupa.com/t/dynamic-changing-text/4770/4 "2002-08-21T19:39:21Z")

</div>

your text file has to have variables declared like

text1=“this is my text for button 1”&text2=“this is my text for button2”

put all this into one file, call the file whatever you want (like button.txt)

use loadvariables(“button.txt”,"\_root.caps")

---

<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:** [August 22, 2002, 7:48pm UTC](https://forum.kirupa.com/t/dynamic-changing-text/4770/5 "2002-08-22T19:48:11Z")

</div>

Ok, But just a few more Questions,

Where does the action go,  
and how does each button know which text to display?

I have seen something similar but couldn’t work it out!!

:-\

Cheers for you time
