Flash CS3 UIScrollBar Not Scrolling Bug
So I’m updating an old Flash project to AS3, and I need a quick solution to add a few scrollbars onto a few textboxes. So I get out the Flash CS3 UIScrollBar. Only problem is, it’s not working. Works in a standalone FLA, but when I bring it into my app, there’s no scroll bar, no arrows, and the component is unresponsive to textfield content changes.
The UIScrollBar class is a simple scrollbar component that ships with Flash CS3 and CS4, that when associated with a given TextField, enables you to scroll that TextField. Simple, right? Or it should be. After cursing the gods for yet another buggy Flash component — I mean, I thought the days of hacking through the Flash component set to get it to frakin work were done with! So after slogging through a few useless hacks — like purposefully populating the textfield with a gazillion line feeds to get the scrollbar to initialize, then deleting them — I figured out a solution.
There must be a bug with the component, because it was not registering new text being added to the TextField. If the TextField was populated with more text than vertical space allows before the UIScrollBar initialized, then the scrollbar would work. But this was the exception to the rule, since most textfields in the app would be dynamically populated form an XML file. So I needed a way to force an update of the scrollbar when the content in the TextField had changed.
(more…)