ActionScript 3.0 Language and Components Reference | All Packages | All Classes | Language Elements | Index | Appendixes | Conventions | Frames No Frames |
EastAsianJustifier

Package | flash.text.engine
Class | public final class EastAsianJustifier
Inheritance | EastAsianJustifier TextJustifier Object

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

The EastAsianJustifier class represents properties necessary to control the justification options for text lines in a text block 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

JustificationStyle
LineJustification
TextBlock.textJustifier

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : 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
|  | lineJustification : String Specifies the line justification for the text in a text block. | TextJustifier
|  | locale : String [read-only] Specifies the locale to determine the justification rules for the text in a text block. | TextJustifier
|  | prototype : Object [static] A reference to the prototype object of a class or function object. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku") Creates a EastAsianJustifier object. | EastAsianJustifier
|  | getJustifierForLocale(locale:String):TextJustifier [static] Constructs a default TextJustifier subclass appropriate to the specified locale. | TextJustifier
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

justificationStyle | property

`justificationStyle:String` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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 value | Description
--- | ---
`JustificationStyle.PUSH_IN_KINSOKU` | Specifies push in justification.
`JustificationStyle.PUSH_OUT_ONLY` | Specifies push out justification.
`JustificationStyle.PRIORITIZE_LEAST_ADJUSTMENT` | Specifies justification wherein the least adjustment is prioritized.

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

See also

JustificationStyle
Constructor Detail

EastAsianJustifier | () | Constructor

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

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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

JustificationStyle
LineJustification
Examples How to use examples
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.text.engine.GlyphRotation;
        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 ="�?��?�よ�?��?��?��?��?��?��?気分�?��?��?�？天気予報�?�暖�?��??�?�る�?��?" +
                "時々晴れ。�?��?�行�??方�?�よ�?��?�都市�?��?��?�？�?��?��?�よ�?��?��?��?��?��?�仕事を休ん�?�家�?��?" +
                "庭�?��?��?�？�?�?��?��?��?��?��?食を準備�?�る場�?��?�よ�?��?��?�。";

                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;
                textBlock.glyphRotation = GlyphRotation.FULL_AND_WIDE;

                var baseline:Number = this.stage.stageWidth - 12;

                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, 300);
                    if (textLine == null)
                        break;
                    textLine.y = 20;
                    textLine.x = baseline-120;
                    baseline -= 24;
                    addChild(textLine);
                    previousLine = textLine;
                }
            }
        }
    }

Submit Feedback on LiveDocs
© 2004-2008 Adobe Systems Incorporated. All rights reserved.
Tue May 20 2008, 04:02 AM -07:00