The following example shows how you can create a simple TextContainerManager in Flex 4 using the Text Layout Framework (TLF) classes.
Full code after the jump.
The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 beta, check out the Adobe Flash Builder 4 page on the Adobe Labs site. To download the latest build of the Flex 4 SDK, see http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4. For instructions on using the beta Flex 4 SDK in Flex Builder 3, see "Using the beta Flex 4 SDK in Flex Builder 3".
package { import flash.display.Sprite; import flashx.textLayout.container.TextContainerManager; [SWF(width="550", height="300")] public class TextContainerManager_setText_test extends Sprite { public function TextContainerManager_setText_test() { var spr:Sprite = new Sprite(); addChild(spr); spr.x = 40; spr.y = 50; var tcm:TextContainerManager = new TextContainerManager(spr); tcm.compositionWidth = 300; tcm.compositionHeight = 200; tcm.setText("(1)The quick brown fox jumps over the lazy dev. (2)The quick brown fox jumps over the lazy dev. (3)The quick brown fox jumps over the lazy dev. (4)The quick brown fox jumps over the lazy dev. (5)The quick brown fox jumps over the lazy dev."); tcm.updateContainer(); } } }
This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.

{ 4 comments… read them below or add one }
I must be missing something because this doesn’t appear to compile even when using the nightly (8654 build) SDK. I get several “Type was not found or was not a compile-time constant” errors pointing at TextBlock and TextLine as the missing classes.
Ok… slightly embarrassed now. I forgot to change the required Flash player version to 10 in the projects properties.
Rob,
Out of curiosity, are you using Flex Builder 3, or Flash Builder 4 beta? If you are using FB4, it should correct the Player version automatically based on the current SDK version (unless you disabled that).
Peter
I was using Flex Builder 3. It’s good to know that Flash Builder will help me avoid forgetting that setting though.