Hello all,
I am looking for some opinions or ideas for the best way to do this. I have a scene that is loading a swf. I have a dynamic text field that is displaying captions relating to what is happening in the loaded swf. The captions are relatively short and I am wondering what the best way to display them would be?
Right now I am loading from a text file and can dynamically load the next file using this:
[AS]
function loadCaptionText(){
textnum ++;
nextText = “text/”[textName]+"[textNum]+".txt";
loadText.load(nextText);
if(textnum == 3){
clearInterval(textLoad);
trace(nextText);
};
[/AS]
While that works fine, I’d like to keep all the captions in the same document so the client can edit them easily. Can I somehow define blocks of text in a text document. I remember that text files used to (still do?) start out with a variable name (ie myText=). Can something like that be done? I was never clear how that worked and why it was sometimes needed and sometimes not.
Another option would be to create an XML file and simply advance through the children, but that would might make the editing a bit trickier onthe clients side.
Anyway, here’s what I am using now. Let me know if something can be done to make this easier.
[AS]
this.createTextField(“textField”, 99, 50, 50, 450, 300);
var loadText:LoadVars = new LoadVars();
textField.html = true;
textField.selectable = true;
textField.condenseWhite = true;
textField.multiline = true;
textField.wordWrap = true;
textField.mouseWheelEnabled = true;
textField.styleSheet = cssStyles;
//textField.htmlText = this.varInTextFile; //something with this maybe?
loadText.onData = function(src:String) {
if (src != undefined) {
textField.text = src;
} else {
trace("Could not load text file.");
}
};
[/AS]
And one more question. I am planning on syncing the captions up with the loaded swf by using function calls in the LMC tween classes used in the imported swf. Something like this:
clipThing.alphaTo(0, 4,“linear”,12,caption2);
Where caption2 is a function that loads the next block of text. Anyone see any problems with this or a better way to do it? Am I going to need to add _root or anything to get communication between the two swf’s (main and loaded)working?
Thanks a bundle for any help!
PS I have no idea why my text is appearing blue in this message as I am closing the AS tag.