I've got a small app that reads the contents of a text file and then displays those contents on a Flash banner. The text file reads: Test=This is a test.
Here's the problem: I can read the contents of the text file but for some reason it won't display on the banner. If I hard code the value of the string in place of this.Text.toString, to something like say... "TEST", for example, my banner scrolls "TEST" just as it should. So, it's like I'm 80% of the way there but need help sorting out why the banner's not getting the dynamic value it needs.
If I trace this.Text.ToString() right before the call to placeText, the value displayed is correct - just like it reads in the text file, so I think it's getting passed properly. Thoughts?? Thanks.
Here's the problem: I can read the contents of the text file but for some reason it won't display on the banner. If I hard code the value of the string in place of this.Text.toString, to something like say... "TEST", for example, my banner scrolls "TEST" just as it should. So, it's like I'm 80% of the way there but need help sorting out why the banner's not getting the dynamic value it needs.
If I trace this.Text.ToString() right before the call to placeText, the value displayed is correct - just like it reads in the text file, so I think it's getting passed properly. Thoughts?? Thanks.
Code:
function placeText(target:MovieClip, x:Number, y:Number, banner:String, tFormat:TextFormat, effectFunction:Function, delay:Number):Void {
// For each character...
for (var i = 0; i<banner.length; i++) {
// Create a clip and place the current
// character in the text field inside it.
var char:MovieClip = target.attachMovie("letter", "char"+i, target.getNextHighestDepth());
char.field.text = banner.substr(i, 1);
char._x = x;
char._y = y;
// Add the width of the current text character to the
// next letter's x position.
x += tFormat.getTextExtent(char.field.text).width;
//
// Here is the effect function call, passed in as a parameter
effectFunction(char, i*delay);
}
var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.size = 14;
trace(this.Text.toString());
placeText(this, 7.5, 1, this.Text.toString(), format, fadeZoom, 100);
} else {
//trace("Error loading/parsing LoadVars.");
}
};
my_lv.load("ExampleFlashTextFile.txt");