Now “textBoxInstance” is the instance name of your text box believe it or not. And instead of:
[AS]scroller.text = this.newstext;[/AS]
You should use:
[AS]scroller.htmlText = this.newstext;[/AS]
Thus, if you were to correct the code you provided so that your textbox was html enabled and read the .txt file as if it were htmlText (so that you can use the limited number of html tags that work), it would look like this:
[AS]
loadText = new loadVars();
loadText.load(“news.txt”);
//creating the loadVarsText function
loadText.onLoad = function() {
scroller.html = true;
scroller.htmlText = this.newstext;
};
[/AS]
Enjoy :),
JK.
[bear in mind that I assumed your textbox’s instance name was scroller because that is what your previous code used]
If you don’t want a large gap before the text in your textbox. Don’t jump between using the html code (like <br>) and using Enter to adjust the way the text appears until you have it all working. Stick to one.
Also, check the line spacing of the textbox via the “Format…” button of the properties panel when the textbox is selected. Try setting it to 2 for now.
Hmm… didn’t realise that html would be enabled in my posts. I had used the line break html code and it came up just with the line break - without the actual code, which is what I was trying to use to explain. And I can’t seem to get around that…
Remove the align html code you used in the text file. Instead, edit the properties of the textbox so that it is set to align the text to the left. See if that solves the problem :).
Ok. I have it all aligning fine now. My textbox was originally set to align text to the left and I haven’t touched that. I have just stuck the text from the text file you provided into a document and edited it accordingly.
If you enter your text as follows:
[AS]
newstext=<b>01/06/03</b>
<p align=“left”>
Site is almost done…(linebreak)Yep…(linebreak)About right
[/AS]
Note that this isn’t ActionScript but I can’t stop the html tags acting as html tags in my posts without using this. Therefore, make sure to replace (linebreak) with the html code for a linebreak.
Then this is what it should look like when you run the .swf:
[AS]01/06/03
Site is almost done…
Yep…
About right
[/AS]
The text is all aligned left and is working fine. If you follow this example, I think you should be able to solve your final problem - if you haven’t already.
Well… I have renamed and adjusted my .fla so that it will read your news.txt file instead of my one and I haven’t change anything else in the .fla
I have also edited your news.txt so that I have aligned left, right and center using the html code and have used bold and underline. I think the problem has to be in your .fla which means you may have made a mistake when following the tutorial…
The .fla is too large to attach so I will put it up on my own hosting and provide a download link in a second. I will only leave it up for a few minutes so be quick :).