I am having difficulty getting my dynamic text field to display external
HTML-formatted text. I can get non-HTML formatted text to appear by using the
following method:
Action script calling the external file: loadVariables("ExternalText.txt",
DynamicTextField.text);
In the properties inpector for my dynamic text field: Variable: Var2; Instance
Name: DynamicTextField
In my External.txt file: Var2=This is the text I want to display.
However, when I try to change my external text to HTML, I get a blank text
field. Here are the settings that DON'T work:
Action script calling the external file: loadVariables("ExternalText.txt",
DynamicTextField.htmlText);
Action script calling the external file: loadVariables("ExternalText.txt",
DynamicTextField.text);
In the properties inspector for my dynamic text field: Variable: Var2;
Instance Name: DynamicTextField; Render text as HTML: checked (true)
In my External.txt file: Var2=This is the <b>HTML</b> text I want to display.
In my External.txt file: Var2="This is the <b>HTML</b> text I want to display."
Any suggestions on why my HTML-formatted text does not appear when my
non-HTML-formatted text appears just fine?
Thanks in advance!
adireddy - 23 May 2005 09:27 GMT
You should use DynamicTextField.htmlText
Also try the code attached for better control on loading. Also refer
http://www.devarticles.com/c/a/Flash/The-Power-of-LoadVars-Object/
var txtload:LoadVars = new LoadVars();
txtload.load("ExternalText.txt");
txtload.onLoad = function(){
DynamicTextField.htmlText = txtload.Var2;
}
John Whittington - 29 May 2005 18:53 GMT
I am having the same problem as Joe was (is?), and Adi's solution doesn't work
for me. Like Joe, I am loading an external text file into a dynamic text box.
The text file is formatted as html, though the extension is .txt. Anything
between formatting tags disappears from the text, but the other text shows up
fine. Render text as HTML is checked; I've also tried using code to set
DynamicTextField.html = true.
This is driving me insane. Is there a solution out there? I've attached two
different chunks of code to illustrate my attempts at making this work.
Much thanks to anyone who can help out.
//first try:
loadText = new LoadVars();
loadText.load("homepage.html");
loadText.onLoad = function() {
hometext.html = true;
homeText.htmlText = this.homepage;
};
//second try (Adi's code):
var txtload:LoadVars = new LoadVars();
txtload.load("homepage.txt");
txtload.onLoad = function(){
homeText.html = true;
homeText.htmlText = txtload.home;
}