Recently I had to load the text from external source in Flash and from the design of the application I had to rely on LoadVars command.
No wonder, that quite soon I came up with a problem that Flash does not display special characters like “+”, “%” or “&” if those characters are loaded into Flash via LoadVars. After a bit of research, I found out that LoadVars object method “load” operates with URL encoded strings to allow to include those special characters into string of text.
A good reference table with URL Encoding table for special characters can be found here at
Flash TechNote URL Encoding: Reading special characters from a text file.
The more extensive list of Unicode escape sequence codes in PDF format can be obtained from Unicode.org.
Therefore in Flash,
and so on…
In ActionScript code:
this.createTextField(“result_ta”,1, 0,0,150,20);
result_ta.embedFonts =false;
var myData_lv = new LoadVars();
myData_lv.load (“myText.txt”);
myData_lv.onLoad = function()
{
result_ta.text = myData_lv.sp1_title_1;
}
Content of “myText.txt”:
As a concluding note, an extensive paragraph on how to work with special characters in Flash 6 and higher is written at PDF file:“Using ActionScript in Flash” (Page 118 “Working with text”)