パッケージflash.text.engine
クラスpublic final class SpaceJustifier
継承SpaceJustifier Inheritance TextJustifier Inheritance Object

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

SpaceJustifier クラスは、テキストブロック内のテキスト行に対する位置揃えオプションを制御するために必要なプロパティを表します。

SpaceJustifier オブジェクトのプロパティを設定する前に、コンストラクタ new SpaceJustifier() を使用して SpaceJustifier オブジェクトを作成する必要があります。SpaceJustifier オブジェクトが TextBlock に適用された後で SpaceJustifier オブジェクトのプロパティを設定しても、TextBlock は無効化されません。

例を表示

関連項目

LineJustification
TextBlock.textJustifier
TextJustifier


パブリックプロパティ
 プロパティ定義元
 Inheritedconstructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクタ関数への参照です。
Object
  letterSpacing : Boolean
位置揃えに文字間隔を使用するかどうかを指定します。
SpaceJustifier
 InheritedlineJustification : String
テキストブロック内のテキストの行の位置揃えを指定します。
TextJustifier
 Inheritedlocale : String
[読み取り専用] テキストブロック内のテキストの位置揃え規則を決定するためのロケールを指定します。
TextJustifier
 Inheritedprototype : Object
[静的] クラスまたは関数オブジェクトのプロトタイプオブジェクトへの参照です。
Object
パブリックメソッド
 メソッド定義元
  
SpaceJustifier(locale:String = "en", lineJustification:String = "unjustified", letterSpacing:Boolean = false)
SpaceJustifier オブジェクトを作成します。
SpaceJustifier
  
[override] SpaceJustifier のクローンコピーを構築します。
SpaceJustifier
 Inherited
[静的] 指定されたロケールに適切なデフォルトの TextJustifier サブクラスを作成します。
TextJustifier
 Inherited
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inherited
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
 Inherited
指定されたプロパティが存在し、列挙できるかどうかを示します。
Object
 Inherited
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
 Inherited
指定されたオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのプリミティブな値を返します。
Object
プロパティの詳細
letterSpacingプロパティ
letterSpacing:Boolean

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

位置揃えに文字間隔を使用するかどうかを指定します。



実装
    public function get letterSpacing():Boolean
    public function set letterSpacing(value:Boolean):void
コンストラクタの詳細
SpaceJustifier()コンストラクタ
public function SpaceJustifier(locale:String = "en", lineJustification:String = "unjustified", letterSpacing:Boolean = false)

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

SpaceJustifier オブジェクトを作成します。LineJustification クラスには、適用可能な行の位置揃えのタイプを指定する定数が含まれます。

パラメータ
locale:String (default = "en") — 位置揃え規則を決定するためのロケールです。デフォルト値は「en」です。
 
lineJustification:String (default = "unjustified") — 段落に対する行の位置揃えタイプです。このプロパティには、LineJustification 定数を使用します。デフォルト値は LineJustification.UNJUSTIFIED です。
 
letterSpacing:Boolean (default = false) — 位置揃えに文字間隔を使用するかどうかを指定します。 デフォルト値は false です。

例外
ArgumentError — 指定された localenull であるか、有効なロケールを表すには短すぎます。
 
ArgumentError — 指定された lineJustification は、LineJustification のメンバーではありません。

関連項目

メソッドの詳細
clone()メソッド
override public function clone():TextJustifier

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

SpaceJustifier のクローンコピーを構築します。

戻り値
TextJustifierSpaceJustifier オブジェクトのコピーです。
例の使用法
SpaceJustifierExample.as

次の例では、文字間隔を使用して、最後の行を除くテキストのブロックすべてを位置揃えします。

package {
    import flash.display.Sprite;
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextElement;
    import flash.text.engine.TextLine;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.SpaceJustifier;
    import flash.text.engine.LineJustification;
    
    public class SpaceJustifierExample extends Sprite {
        
        public function SpaceJustifierExample():void {
            var str:String = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
            "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut " +
            "enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " +
            "aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit " +
            "in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur " +
            "sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt " +
            "mollit anim id est laborum.";
            
            var format:ElementFormat = new ElementFormat(null, 12, 0xCC0000);
            var textElement:TextElement = new TextElement(str, format);
            var spaceJustifier:SpaceJustifier = new SpaceJustifier("en", LineJustification.ALL_BUT_LAST);
            spaceJustifier.letterSpacing = true;
            var textBlock:TextBlock = new TextBlock();
            textBlock.content = textElement;
            textBlock.textJustifier = spaceJustifier;
            createLines(textBlock);
        }
        
        private function createLines(textBlock:TextBlock):void {
        
            var yPos = 20;
            var textLine:TextLine = textBlock.createTextLine (null, 150);
 
            while (textLine)
            {
                addChild(textLine);
                textLine.x = 15;
                yPos += textLine.textHeight+2;
                textLine.y = yPos;
                textLine = textBlock.createTextLine(textLine, 150);
            }        
        }
    }
}




 

 

このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート

現在のページ: http://livedocs.adobe.com/flex/3_jp/langref/flash/text/engine/SpaceJustifier.html