Flex 4中如何创建一个简单的TLF TextContainerManager的例子

接下来的例子演示了Flex 4中如何利用Text Layout Framework (TLF),创建一个简单的TLF TextContainerManager。

要编译本例代码需要Flash Player 10和Adobe Flex 4 SDK。

下面是main.mxml:

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();
}
}
}

代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Leave a Reply

Your email address will not be published. Required fields are marked *