用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: 正在从服务器检索数据...
正在从服务器检索数据...
flash.text.engine 

EastAsianJustifier  - AS3

flash.text.engine
public final class EastAsianJustifier
继承EastAsianJustifier Inheritance TextJustifier Inheritance Object

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

EastAsianJustifier 类具有控制文本行(其内容主要为东亚文字)的对齐选项的属性。

使用构造函数 new EastAsianJustifier() 创建 EastAsianJustifier 对象后才能设置其属性。将 EastAsianJustifier 对象应用于 TextBlock 后设置该对象的属性不会使 TextBlock 无效。

查看示例

相关 API 元素



公共属性
 属性由以下参数定义
  composeTrailingIdeographicSpaces : Boolean
指定在对齐过程中是应组合还是删除行结尾处的象形空格。
EastAsianJustifier
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
  justificationStyle : String
指定文本块中文本的对齐方式。
EastAsianJustifier
 InheritedlineJustification : String
指定文本块中文本的行对齐方式。
TextJustifier
 Inheritedlocale : String
[只读] 指定用于确定文本块中文本的对齐规则的区域设置。
TextJustifier
公共方法
 方法由以下参数定义
  
EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku")
创建一个 EastAsianJustifier 对象。
EastAsianJustifier
  
[覆盖] 构造 EastAsianJustifier 的克隆副本。
EastAsianJustifier
 Inherited
[静态] 构造对应于指定的区域设置的默认 TextJustifier 子类。
TextJustifier
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
属性详细信息

composeTrailingIdeographicSpaces

属性
composeTrailingIdeographicSpaces:Boolean

语言版本: ActionScript 3.0
运行时版本: Flash Player 10.3, AIR 2.7

指定在对齐过程中是应组合还是删除行结尾处的象形空格。

默认值为 false



实现
    public function get composeTrailingIdeographicSpaces():Boolean
    public function set composeTrailingIdeographicSpaces(value:Boolean):void

justificationStyle

属性 
justificationStyle:String

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定文本块中文本的对齐方式。

默认值为 JustificationStyle.PUSH_IN_KINSOKU

使用 JustificationStyle 类中的一个常量设置此属性的值。下表列出了可能的值:

字符串值说明
JustificationStyle.PUSH_IN_KINSOKU指定推进对齐。
JustificationStyle.PUSH_OUT_ONLY指定推出对齐。
JustificationStyle.PRIORITIZE_LEAST_ADJUSTMENT指定优先采用需最少量调整的对齐方式。



实现
    public function get justificationStyle():String
    public function set justificationStyle(value:String):void

相关 API 元素

构造函数详细信息

EastAsianJustifier

()构造函数
public function EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku")

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

创建一个 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 — 指定的 localenull 或太短,不能表示有效的区域设置。
 
ArgumentError — 指定的 lineJustification 不是 LineJustification 的成员。
 
ArgumentError — 指定的 justificationStyle 不是 JustificationStyle 的成员。

相关 API 元素

方法详细信息

clone

()方法
override public function clone():flash.text.engine:TextJustifier

语言版本: ActionScript 3.0
运行时版本: Flash Player 10, AIR 1.5, Flash Lite 4

构造 EastAsianJustifier 的克隆副本。

返回
flash.text.engine:TextJustifierEastAsianJustifier 对象的副本。
EastAsianJustifierExample.as

本示例通过使用 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;
            }
        }
    }
}






[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。