# Loading a \*.txt file using loadVars() into a Dynamic Text Field with html tags?

**URL:** <https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290>\
**Category:** flash\
**Created:** [January 15, 2003, 1:24am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290 "2003-01-15T01:24:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Marc](https://forum.kirupa.com/u/Marc)\
**Post date:** [January 15, 2003, 1:24am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/1 "2003-01-15T01:24:46Z")

</div>

I’m loading a \*.txt file using loadVars() into a Dynamic Text Field and having no trouble with that part.

But I am wondering how I can add html tags within the \*.txt file and have flash render it as it does with strings internally? Is there a way of doing this with AS? Anyone got 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 15, 2003, 1:49am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/2 "2003-01-15T01:49:31Z")

</div>

I don’t know anything much about xml but is there a way of doing this with this language?

I wish there was a way of doing this so I could dynamically update DTF’s externally and have control of the presentation of the text with html. Instead of just the settings for the DTF.

Thanks for any 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:** [January 15, 2003, 2:12am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/3 "2003-01-15T02:12:41Z")

</div>

1st question: use html=true and then htmlText instead of text.  
2nd question: there’s an XML tute in the best of Kirupa section.

pom :elderly:

---

<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 15, 2003, 2:24am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/4 "2003-01-15T02:24:40Z")

</div>

I try this out.

Cheers

---

<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 15, 2003, 2:34am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/5 "2003-01-15T02:34:58Z")

</div>

I only needed to change text to htmlText and it worked. Here’s the AS I used:

```php
loadText = new loadVars();
loadText.load("news.txt");
loadText.onLoad = function() {
	newsUpdate.htmlText = this.textUpdate1;
};

```

I’m wondering where I need to place the html=true bit and whether it will make a great difference if I leave it out.

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:** [January 15, 2003, 2:44am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/6 "2003-01-15T02:44:00Z")

</div>

Well, it’s not supposed to work if you don’t put it :beam:  
Did you manually set your text as html text?

---

<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 15, 2003, 8:23am UTC](https://forum.kirupa.com/t/loading-a-txt-file-using-loadvars-into-a-dynamic-text-field-with-html-tags/11290/7 "2003-01-15T08:23:56Z")

</div>

Oh, silly me! I forgot that I manually rendered the DTF as HTML. As a test, I manaully unset the DTF from rendered as HTML and tested the movie and it no longer worked. I then placed the other bit of code in like this:

```php
loadText = new loadVars();
loadText.load("news.txt");
loadText.onLoad = function() {
	newsUpdate.html = true;
	newsUpdate.htmlText = this.textUpdate1;
};

```

And it did!

I didn’t realise till now that I could control the properties of the TextField object via AS. Nice one for putting me in the right direction :beam:

On the other hand, after some more experimentation and reading, I began to notice that many of the propertities that I can set with AS can not be set with the Property Inspector. i.e. backgroundColor and borderColor. Interesting. 🙂
