Horizontally scrolling htmlText problem

O.K., I found a script that scrolls the contents of textbox from right to left, then repeats. This works great, until I add HTML formatting to the text string…
The problem is that Flash seems to get confused and sets the maxHscroll to an incorrect number.

Here’s the code that only seems to scroll NON-html text just fine:


var special = "this is a freakin test. <B>here is some bold text</B>. <I>italics, whew!!!!</i>";
//var special = "this is a freakin test. here is some bold text. italics, whew!!!!";
this.createTextField("scroller_txt", 1, 0, 0, 640, 35);
scroller_txt.spacebuffer = " ";
scroller_txt.border = true;
scroller_txt.speed = 1;
scroller_txt.multiline = true;
scroller_txt.variable = "special";
scroller_txt.spaceSize = scroller_txt.getNewTextFormat().getTextExtent(" ").width;
scroller_txt.spacesRequired = Math.ceil(scroller_txt._width/scroller_txt.spaceSize);
for (var i = 0; i<scroller_txt.spacesRequired; i++) {
scroller_txt.spacebuffer += " ";
}
scroller_txt.html = true;
scroller_txt.htmlText = scroller_txt.spacebuffer+special+scroller_txt.spacebuffer;
scroller_txt.hscrollInterval = function() {
if (this.hscroll == this.maxhscroll) {
this.hscroll = 0;
}
this.hscroll += this.speed;
};
setInterval(scroller_txt, "hscrollInterval", 10);

Try using the above chunk of code, and uncomment the other variable ‘special’ and see how it scrolls fine, but with HTML formatting, it gets confused - just like me!

I would just format the text by using TextFormat, but i really need to use HTML formatting so I can add multiple URLS, different colors, etc. in the string.

If ANYONE could help me with this one, I’d be one happer coder and you could say that you’ve done your good deed for the day. ha. :slight_smile:

Thanks in advance,
-JakeMAN