| 包 | flashx.textLayout.formats |
| 类 | public final class TextAlign |
| 继承 | TextAlign Object |
| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
textAlign 和 textAlignLast 属性定义值。这些值描述了段落中的行与容器的对齐方式。
相关 API 元素
公共常量
| 常量 | 由以下参数定义 | ||
|---|---|---|---|
| CENTER : String = "center" [静态] 指定与容器中心对齐。 | TextAlign | ||
| END : String = "end" [静态] 指定结束边缘对齐 - 文本与书写顺序的结束端对齐。 | TextAlign | ||
| JUSTIFY : String = "justify" [静态] 指定文本在行内两端对齐,以便位于容器空间范围内。 | TextAlign | ||
| LEFT : String = "left" [静态] 指定左边缘对齐。 | TextAlign | ||
| RIGHT : String = "right" [静态] 指定右边缘对齐。 | TextAlign | ||
| START : String = "start" [静态] 指定起始边缘对齐 - 文本与书写顺序的起始端对齐。 | TextAlign | ||
常量详细信息
CENTER | 常量 |
public static const CENTER:String = "center"| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定与容器中心对齐。
END | 常量 |
public static const END:String = "end"| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定结束边缘对齐 - 文本与书写顺序的结束端对齐。等效于将从左至右的文本指定为右对齐,或将从右至左的文本指定为左对齐。
JUSTIFY | 常量 |
public static const JUSTIFY:String = "justify"| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定文本在行内两端对齐,以便位于容器空间范围内。
LEFT | 常量 |
public static const LEFT:String = "left"| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定左边缘对齐。
RIGHT | 常量 |
public static const RIGHT:String = "right"| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定右边缘对齐。
START | 常量 |
public static const START:String = "start"| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定起始边缘对齐 - 文本与书写顺序的起始端对齐。等效于将从左至右的文本设置为左对齐,或将从右至左的文本设置为右对齐。
示例 如何使用本示例
TextAlignExample.as
此示例将使用 CENTER、JUSTIFY 和 RIGHT 对齐来对齐“Hello World”的三个段落。
package flashx.textLayout.formats.examples {
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextAlign;
import flashx.textLayout.formats.TextJustify;
public class TextAlignExample extends Sprite
{
public function TextAlignExample()
{
var textFlow:TextFlow = new TextFlow();
//create paragraphs and corresponding spans
var pCenter:ParagraphElement = new ParagraphElement();
var pJustify:ParagraphElement = new ParagraphElement();
var pRight:ParagraphElement = new ParagraphElement();
var spanCenter:SpanElement = new SpanElement();
var spanJustify:SpanElement = new SpanElement();
var spanRight:SpanElement = new SpanElement();
// add text to the spans
spanCenter.text = "Hello, World\n";
spanJustify.text = "Hello, World\n";
spanRight.text = "Hello, World";
// add spans to paragraphs and specify alignment
pCenter.addChild(spanCenter);
pCenter.textAlign = TextAlign.CENTER;
pJustify.addChild(spanJustify);
pJustify.textAlign = TextAlign.JUSTIFY;
pJustify.textJustify = TextJustify.DISTRIBUTE;
pRight.addChild(spanRight);
pRight.textAlign = TextAlign.RIGHT;
// add paragraphs to TextFlow
textFlow.addChild(pCenter);
textFlow.addChild(pJustify);
textFlow.addChild(pRight);
// update controller to display
textFlow.flowComposer.addController(new ContainerController(this,80,800));
textFlow.flowComposer.updateAllControllers();
}
}
}
Tue Jun 12 2018, 11:04 AM Z
隐藏继承的公共属性
显示继承的公共属性