This is a how-to showing how to make text in a text box scroll continuously.
There already exists the capability to cause text boxes to scroll:
Code:
playListText0.enabledHorzScroll="true";
playListText0.enabledHorzScroll="false";
The text then scrolls but only if the text is longer than its container field. This is a limitation. Other javascript engines allow the text to be scrolled regardless of its length. It can just be set to scroll, the direction can be set and it can be turned on/off as above.
So, some code is needed to overcome XW's inability to scroll text in a text field that is shorter than the field length.
Code:
playListText0.constraints.maxWidth="206"
// in addition to the following a constraint needs to be set on the field itself, setting the maxwidth in the
// IDE because any changes to playListText0.text.length are dynamic.
textLength = playListText0.text.length; // count track name length
playListText0.width = textLength * 6.5; // set the text field length for the text itself
playListText0.enabledHorzScroll="true"; //start the scrolling
This shortens the text field dynamically so that it is slightly shorter than the text itself. Therefore any text that is placed into the field with scroll regardless of the initial length of the field or the text length.
A small problem is that any text field background styling displays a foreshortened field. The solution to this is to have another text field below it that is full width which displays the same styling characteristics.
If you have a better method of making text scroll in a text box then post it here as your own how-to.