| 包 | flash.text.engine |
| 类 | public final class EastAsianJustifier |
| 继承 | EastAsianJustifier TextJustifier Object |
| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
使用构造函数 new EastAsianJustifier() 创建 EastAsianJustifier 对象后才能设置其属性。将 EastAsianJustifier 对象应用于 TextBlock 后设置该对象的属性不会使 TextBlock 无效。
另请参见
| 属性 | 定义方 | ||
|---|---|---|---|
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。 | Object | |
| justificationStyle : String 指定文本块中文本的对齐方式。 | EastAsianJustifier | ||
![]() | lineJustification : String 指定文本块中文本的行对齐方式。 | TextJustifier | |
![]() | locale : String [只读 (read-only)] 指定用于确定文本块中文本的对齐规则的区域设置。 | TextJustifier | |
![]() | prototype : Object [静态]
对类或函数对象的原型对象的引用。 | Object | |
| 方法 | 定义方 | ||
|---|---|---|---|
EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku") 创建一个 EastAsianJustifier 对象。 | EastAsianJustifier | ||
构造 EastAsianJustifier 的克隆副本。 | EastAsianJustifier | ||
![]() | [静态] 构造对应于指定的区域设置的默认 TextJustifier 子类。 | TextJustifier | |
![]() |
指示对象是否已经定义了指定的属性。 | Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() |
指示指定的属性是否存在、是否可枚举。 | Object | |
![]() |
设置循环操作动态属性的可用性。 | Object | |
![]() |
返回指定对象的字符串表示形式。 | Object | |
![]() |
返回指定对象的原始值。 | Object | |
| justificationStyle | 属性 |
justificationStyle:String [读写] | 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定文本块中文本的对齐方式。
默认值为 JustificationStyle.PUSH_IN_KINSOKU。
使用 JustificationStyle 类中的一个常量设置此属性的值。下表列出了可能的值:
| 字符串值 | Description |
|---|---|
JustificationStyle.PUSH_IN_KINSOKU
| 指定推进对齐。 |
JustificationStyle.PUSH_OUT_ONLY
| 指定推出对齐。 |
JustificationStyle.PRIORITIZE_LEAST_ADJUSTMENT
| 指定优先采用需最少量调整的对齐方式。 |
public function get justificationStyle():String public function set justificationStyle(value:String):void另请参见
| EastAsianJustifier | () | 构造函数 |
public function EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku")| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
创建一个 EastAsianJustifier 对象。
参数locale:String (default = "ja") —
用于确定对齐规则的区域设置。默认值为 "ja"。
| |
lineJustification:String (default = "allButLast") —
段落的行对齐类型。将 LineJustification 常量用于此属性。默认值为 LineJustification.ALL_BUT_LAST。
| |
justificationStyle:String (default = "pushInKinsoku") —
使用东亚对齐符的文本块中文本的对齐样式。将 JustificationStyle 常量用于此属性。默认值为 JustificationStyle.PUSH_IN_KINSOKU。
|
ArgumentError —
指定的 locale 为 null 或太短,不能表示有效的区域设置。
| |
ArgumentError —
指定的 lineJustification 不是 LineJustification 的成员。
| |
ArgumentError —
指定的 justifictionStyle 不是 JustificationStyle 的成员。
|
另请参见
| clone | () | 方法 |
override public function clone():TextJustifier| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
构造 EastAsianJustifier 的克隆副本。
返回TextJustifier —
EastAsianJustifier 对象的副本。
|
package {
import flash.text.engine.TextBlock;
import flash.text.engine.TextLine;
import flash.text.engine.TextElement;
import flash.text.engine.TextBaseline;
import flash.text.engine.EastAsianJustifier;
import flash.text.engine.LineJustification;
import flash.text.engine.TextRotation;
import flash.text.engine.FontDescription;
import flash.text.engine.ElementFormat;
import flash.display.Stage;
import flash.display.Sprite;
import flash.system.Capabilities;
public class EastAsianJustifierExample extends Sprite {
public function EastAsianJustifierExample():void {
var Japanese_txt:String = String.fromCharCode(
0x5185, 0x95A3, 0x5E9C, 0x304C, 0x300C, 0x653F, 0x5E9C, 0x30A4,
0x30F3, 0x30BF, 0x30FC, 0x30CD, 0x30C3, 0x30C8, 0x30C6, 0x30EC,
0x30D3, 0x300D, 0x306E, 0x52D5, 0x753B, 0x914D, 0x4FE1, 0x5411,
0x3051, 0x306B, 0x30A2, 0x30C9, 0x30D3, 0x30B7, 0x30B9, 0x30C6,
0x30E0, 0x30BA, 0x793E, 0x306E
) +
"FMS 2" +
String.fromCharCode(0x3092, 0x63A1, 0x7528, 0x3059, 0x308B, 0x3068,
0x767a, 0x8868, 0x3057, 0x307e, 0x3057, 0x305F, 0x3002);
var textBlock:TextBlock = new TextBlock();
var font:FontDescription = new FontDescription();
var format:ElementFormat = new ElementFormat();
format.fontSize = 12;
format.locale = "ja";
format.color = 0xCC0000;
textBlock.baselineZero = TextBaseline.IDEOGRAPHIC_CENTER;
textBlock.textJustifier = new EastAsianJustifier("ja", LineJustification.ALL_INCLUDING_LAST);
textBlock.lineRotation = TextRotation.ROTATE_90;
var linePosition:Number = this.stage.stageWidth - 75;
if (Capabilities.os.search("Mac OS") > -1)
// set fontName: Kozuka Mincho Pro R
font.fontName = String.fromCharCode(0x5C0F, 0x585A, 0x660E, 0x671D) + " Pro R";
else
font.fontName = "Kozuka Mincho Pro R";
textBlock.content = new TextElement(Japanese_txt, format);
var previousLine:TextLine = null;
while (true)
{
var textLine:TextLine = textBlock.createTextLine(previousLine, 320);
if (textLine == null)
break;
textLine.y = 20;
textLine.x = linePosition;
linePosition -= 25;
addChild(textLine);
previousLine = textLine;
}
}
}
}