Loading text from an external text at runtime
Another way to include non-Roman text in your Flash file is by loading it from an external text file.
varname1 = 我的文字&varname2=中華民國萬歲
onClipEvent(data) {
//text manipulation routines here. For
example, to place the value of varname1 into a text field called "myText"
_root.myText.text = varname1
//You can split the text into an array,
then put the 3rd word of the sentence into the text field
myArray = varname1.split("");
_root.myText.text = myArray[2];
//Whatever
}
loadVariables("externalText.txt", "_root.mc1");
Note: In case you're wondering why I don't use the LoadVars object, I have found that it does not "reset." After running successfully once, the function will not re-check the file a second time. In other words, if you load the text file once, then change the text file, and try to re-load it, the function will think it has already successfully loaded the text file, and will not bother to do it again. The LoadVariables command is stateless, and so I chose to use it instead.
This tip was written by Dennie Hoopingarner of the Center for Language Education And Research (CLEAR) at Michigan State University. Copyright © 2003 by Michigan State University Board of Trustees. All rights reserved.