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

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?

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

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:

I try this out.

Cheers

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

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

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

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:

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. :slight_smile: