The TextFlow class allows you to flow text between text fields easily in Flash player 9. It has configurable support for orphans and widows (lines left at the start and end of a field respectively), as well as a simple API for getting the "overflow" from any field (or the whole flow).

It builds on the TextFlowLite class I posted a few days ago, sharing the same functionality and adding the following APIs:

// change orphans and widows (defaults to 2):
myTextFlow.orphans = 3;
myTextFlow.widows = 2;

// get any text that overflows past the bottom of the last text field in the flow:
// this can be handy for paging.
myTextFlow.getOverflow();

// get the text that overflows past the 2nd text field in the flow:
myTextFlow.getOverflow(1);

// change the flow's text fields:
myTextFlow.textFields = [fld1,fld2,fld3];

Here are a couple of demos. The first is nearly identical to the demo for TextFlowLite, but it takes advantage of the getOverflow method to display a "more" indicator when the text overflows the last field. It also has orphans and widows set to 2, so you should never have a single line of text dangling at the top or bottom of a field.

This second demo shows another use for these classes: fitting dynamic text to a shape, or flowing it between shapes. I'm actually kind of happy with how my vector Christmas decorations turned out. :)

You can download TextFlow and both of the demos by clicking here.

The third version of this set "TextFlowPro" will be released next week some time. It supports selection, copying, tab ordering, editing, and more. I had forgotten how complex it was, and it's going to take me a while to clean it up. Even with that, it might still be mostly a tech demo due to some minor issues I haven't been able to resolve.