# Dynamic text

**URL:** https://forum.kirupa.com/t/dynamic-text/22107
**Category:** Uncategorized
**Created:** [May 30, 2003, 10:28am UTC](https://forum.kirupa.com/t/dynamic-text/22107 "2003-05-30T10:28:10Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![chris9902](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@chris9902](https://forum.kirupa.com/u/chris9902)
#### Post date: [May 30, 2003, 10:28am UTC](https://forum.kirupa.com/t/dynamic-text/22107/1 "2003-05-30T10:28:10Z")

</div>

ok how to i make a button so when i press it, it loads an external .txt files in my text box in flash

---

<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: [May 30, 2003, 2:51pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/2 "2003-05-30T14:51:38Z")

</div>

There are tutes about text loadings here 🙂

---

<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: [May 30, 2003, 3:16pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/3 "2003-05-30T15:16:17Z")

</div>

were can you post one please

---

<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: [May 30, 2003, 3:40pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/4 "2003-05-30T15:40:00Z")

</div>

here’s the link :):  
[http://www.kirupaforum.com/forums/search.php?s=](http://www.kirupaforum.com/forums/search.php?s=)

---

<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: [May 30, 2003, 3:41pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/5 "2003-05-30T15:41:34Z")

</div>

[http://www.kirupa.com/developer/mx/dynamic\_scroller.htm](http://www.kirupa.com/developer/mx/dynamic_scroller.htm)

😉

---

<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: [May 30, 2003, 3:44pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/6 "2003-05-30T15:44:51Z")

</div>

I’m kind of still new at this myself but I’m pretty sure all you have to do is put a name for the variable (Var:) in the dynamic text properties box (NOT the instance name), for example: textField

Then on your button you say something like:

on (release){  
loadVariables(“external\_text.txt”, textField);}

This says to load the text file called “external\_text” into the dynamic text box you created that you called “textField”.

Hope this helps!

---

<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: [May 30, 2003, 5:47pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/7 "2003-05-30T17:47:49Z")

</div>

i tested that but it did not work

am i doing it wrong

---

<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: [May 30, 2003, 6:04pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/8 "2003-05-30T18:04:24Z")

</div>

upload your .fla file… then we can check to see if you have everything correct

---

<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: [June 2, 2003, 10:08am UTC](https://forum.kirupa.com/t/dynamic-text/22107/9 "2003-06-02T10:08:06Z")

</div>

i’m not the original poster but i can’t get lunatic’s script to work either…

.zip attached

on another note, while searching for an answer i read, io have no idea whether it’s relevant:

[http://www.macromedia.com/support/flash/ts/documents/dynamic\_text\_scrollmx.htm](http://www.macromedia.com/support/flash/ts/documents/dynamic_text_scrollmx.htm)

“Loading text into a dynamic text field in Flash MX is done differently. In Flash MX text is it’s own ActionScript object, so a text field can have both a variable name and an instance name (see Flash MX Text fields have instance names and variable names, TechNote 16184, for details). Flash MX also introduces a more sophisticated action for loading external data called loadVars(). These two methods are combined to load external text to a scrolling text field created using the ScrollBar component.”

---

<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: [June 2, 2003, 12:20pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/10 "2003-06-02T12:20:21Z")

</div>

on (release) {  
loadText = new loadVars();  
loadText.load(“kirupa.txt”);  
loadText.onLoad = function() {  
\_root.textField = loadText;  
};  
}

this seems to work…

anyone any tips how how to get text not show up with %20 as spaces? i tried unicode and a several other formats…

meisje

---

<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: [June 2, 2003, 12:23pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/11 "2003-06-02T12:23:35Z")

</div>

```auto
_root.textField = unescape(loadText);

```

---

<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: [June 2, 2003, 12:31pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/12 "2003-06-02T12:31:16Z")

</div>

thanks kax :toad:

---

<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: [June 2, 2003, 12:33pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/13 "2003-06-02T12:33:16Z")

</div>

you’re welcome. 😉

---

<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: [June 2, 2003, 1:31pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/14 "2003-06-02T13:31:03Z")

</div>

one more issue, a loaded text is always trailed by the following:

=&onLoad=[type Function]

(major thunderstorm is coming turning of puter for the while)

---

<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: [June 2, 2003, 1:42pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/15 "2003-06-02T13:42:08Z")

</div>

if you’re still using the same script you posted above, try adding this line of code:

```auto
ASSetPropFlags(loadText, "onLoad", 1);

```

however, i encourage you to follow the tutorial here at [kirupa.com](http://kirupa.com)  
[http://www.kirupa.com/developer/mx/dynamic\_scroller.htm](http://www.kirupa.com/developer/mx/dynamic_scroller.htm)

---

<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: [June 2, 2003, 2:31pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/16 "2003-06-02T14:31:41Z")

</div>

thanks for the encouragement kax 🙂 i have done the tutorial now, please correct me if i’m wrong:

* * *

scene: button and dynamic textfield.

name the textfield “textField” in the instance name box (this time NOT the var name!!).

on the button hang this script:  
on (release) {  
loadText = new loadVars();  
loadText.load(“kirupa.txt”);  
loadText.onLoad = function() {  
textField.text = this.kirupatext;  
};  
}

then make a textfile and put:  
kirupatext=  
followed directly by the rest of your text.

save the file as:  
kirupa.txt  
for loading other text just copy the code and only change “kirupa.txt” to whatever you want loaded

voilá kirupá 🙂 thanks again kax

---

<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: [June 2, 2003, 2:38pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/17 "2003-06-02T14:38:28Z")

</div>

no problem, meisje. =)

by the way, i think you should read this technote. i’m telling you this because of the instance name you used for the TextField. 😉  
[http://www.macromedia.com/support/flash/ts/documents/naming\_strategies.htm](http://www.macromedia.com/support/flash/ts/documents/naming_strategies.htm)

---

<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: [June 2, 2003, 2:46pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/18 "2003-06-02T14:46:21Z")

</div>

information assimilated :thumb:

and this one is for you :flower: later kax!

---

<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: [June 2, 2003, 2:51pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/19 "2003-06-02T14:51:52Z")

</div>

😛

see ya! 😉

---

<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: [June 3, 2003, 9:47pm UTC](https://forum.kirupa.com/t/dynamic-text/22107/20 "2003-06-03T21:47:05Z")

</div>

I`m trying to use the code creating a function called “loadNote” but the text is not loading

```auto
// define the function loadNote
function loadNote (idnote) {
	_root.attachnote.attachMovie("mcnote", "mcnote", 1);
	_root.attachnote.posY = 300;
	loadText = new LoadVars();
	loadText.load(idnote);
	loadText.onLoad = function () {
		_root.attachnote.mcnote.loadtxt = loadText;
	trace = "function loadNote ok";
	}
}

```

on my btn01 action I wrote:

```auto
on(release) {
// call the function loadNote on stage
	_root.loadNote("cap02/notes/note" + "01" + ".txt");
}

```

The attach action is ok but the text is not loading inside mcnote, in textfield “loadtxt”.

Can some help me? 🙂  
Thanks

[Next page](https://forum.kirupa.com/t/dynamic-text/22107.md?page=2)
