Adobe® Flex® 4 Language Reference
Hide Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.text.engine 
EastAsianJustifier 
Packageflash.text.engine
Classpublic final class EastAsianJustifier
InheritanceEastAsianJustifier Inheritance TextJustifier Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The EastAsianJustifier class has properties to control the justification options for text lines whose content is primarily East Asian text.

Use the constructor new EastAsianJustifier() to create an EastAsianJustifier object before setting its properties. Setting the properties of an EastAsianJustifier object after it has been applied to a TextBlock does not invalidate the TextBlock.

View the examples

See also



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  justificationStyle : String
Specifies the justification style for the text in a text block.
EastAsianJustifier
 InheritedlineJustification : String
Specifies the line justification for the text in a text block.
TextJustifier
 Inheritedlocale : String
[read-only] Specifies the locale to determine the justification rules for the text in a text block.
TextJustifier
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
  
EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku")
Creates a EastAsianJustifier object.
EastAsianJustifier
  
[override] Constructs a cloned copy of the EastAsianJustifier.
EastAsianJustifier
 Inherited
[static] Constructs a default TextJustifier subclass appropriate to the specified locale.
TextJustifier
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

justificationStyle

property
justificationStyle:String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Specifies the justification style for the text in a text block.

The default value is JustificationStyle.PUSH_IN_KINSOKU.

Use one of the constants in the JustificationStyle class to set the value for this property. The following table lists the possible values:

String valueDescription
JustificationStyle.PUSH_IN_KINSOKUSpecifies push in justification.
JustificationStyle.PUSH_OUT_ONLYSpecifies push out justification.
JustificationStyle.PRIORITIZE_LEAST_ADJUSTMENTSpecifies justification wherein the least adjustment is prioritized.



Implementation
    public function get justificationStyle():String
    public function set justificationStyle(value:String):void

See also

Constructor Detail

EastAsianJustifier

()Constructor
public function EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku")

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Creates a EastAsianJustifier object.

Parameters
locale:String (default = "ja") — The locale to determine the justification rules. The default value is "ja".
 
lineJustification:String (default = "allButLast") — The type of line justification for the paragraph. Use LineJustification constants for this property. The default value is LineJustification.ALL_BUT_LAST.
 
justificationStyle:String (default = "pushInKinsoku") — The justification style for the text in a text block using an East Asian justifier. Use JustificationStyle constants for this property. The default value is JustificationStyle.PUSH_IN_KINSOKU.

Throws
ArgumentError — The locale specified is null or too short to represent a valid locale.
 
ArgumentError — The lineJustification specified is not a member of LineJustification.
 
ArgumentError — The justifictionStyle specified is not a member of JustificationStyle.

See also

Method Detail

clone

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

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructs a cloned copy of the EastAsianJustifier.

Returns
flash.text.engine:TextJustifier — A copy of the EastAsianJustifier object.
EastAsianJustifierExample.as

This example displays a block of Japanese text vertically, using EastAsianJustifier properties to justify the text.
 
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;
            }
        }
    }
}