適用於 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 類別提供了控制齊行選項的屬性。

在設定 EastAsianJustifier 物件的屬性之前,您必須使用建構函式 new 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 類別就會以英文顯示。