I read a couple of tutorials under the Flash MX 2004 portion of the site, namely the one about loading a CSS file to influence a text field, and also to do the same while loading the text field’s content from an external file. The first tutorial (use external CSS file, use hard-coded content in the text-field) went fine, but the second one in which the text field’s content is brought in from a .txt file I wasn’t able to get working.
Here’s the exact code I have:
var format = new TextField.StyleSheet();
var path = "flash.css";
format.load(path);
format.onLoad = function(loaded) {
if(loaded) {
output.styleSheet = format;
myLoadVar = new LoadVars();
myLoadVar.load("test.txt");
myloadVar.onLoad = function(success) {
if (success == true) {
output.variable = "kirupa";
output.htmlText = myLoadVar.kirupa;
}
}
} else {
output.text = "Failed";
}
};
The test.txt file’s content is:
kirupa=<p>test test test</p>
The file names are correct, and the text field has been named to output, set to Dynamic, multi-line no wrap, render text as HTML. Every time I load the movie though, the text field remains blank.