Flex Source to the Rescue

Developing in Flex can be very frustrating at times. Latest hangup was due to mx.controls.Text class scrolling content undesirably when mouse wheel is turned. None of the solutions I found online worked but as I started writing my own custom text component, I remembered that Flex came with source code many of the framework classes. So I dove in and found this hidden yet relevant documentation in the source code:

If the Text component has an explicit width, its text wordwraps within that width, and the measured height is tall enough to display all the text. (If there is an explicit height or a percent height in this case, the text may get clipped.)

If it doesn't have an explicit height, the measured height is tall enough to display all the text.

If there is an explicit height or a percent height, the text may get clipped.

With this info, all I had to do was set width explicitly and leave height unspecified to prevent Text component from scrolling.
The lesson here is that, while Adobe provides a lot of documentation, real gems are in the source code.

Advertisements