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

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

TextLineMirrorRegion クラスは、イベントを別のイベントディスパッチャにミラーするテキスト行の部分を表します。

テキスト行に対する通常のイベント送出処理が終了した後で、テキスト行が有効で、イベント通知が停止していない場合は、テキスト行のミラー領域にイベントが送出されます。

マウスイベントのミラーは特殊なケースです。ミラー領域は実際には表示オブジェクトではないので、mouseOver イベントと mouseOut イベントはシミュレートされます。rollOver イベントと rollOut イベントはシミュレートされません。自然に発生するすべての mouseOver イベント、mouseOut イベント、rollOver イベントおよび rollOut イベントは、そのターゲットがテキスト行であるか、テキスト行の子であるかに関係なしに無視され、ミラーされません。

ActionScript コードから直接 TextLineMirrorRegion オブジェクトを作成することはできません。 new TextLineMirrorRegion() を呼び出すと、例外がスローされます。 イベントミラーを ContentElement オブジェクトに割り当てるときには、TextLineMirrorRegion を作成します。

TextLineMirrorRegion クラスは final クラスであるため、サブクラス化することはできません。

例を表示

関連項目

ContentElement.eventMirror
TextBlock.createTextLine()
TextLine.mirrorRegions


パブリックプロパティ
 プロパティ定義元
  bounds : Rectangle
[読み取り専用] テキストラインを基準にするミラー領域の境界です。
TextLineMirrorRegion
 Inheritedconstructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクタ関数への参照です。
Object
  element : ContentElement
[読み取り専用] ミラー領域の派生元の ContentElement オブジェクトです。
TextLineMirrorRegion
  mirror : EventDispatcher
[読み取り専用] ミラー領域に影響を与えるイベントをミラーする先の EventDispatcher オブジェクトです。
TextLineMirrorRegion
  nextRegion : TextLineMirrorRegion
[読み取り専用] テキストエレメントから派生するセット内の次の TextLineMirrorRegion。現在の領域が、セット内の最後のミラー領域である場合は null。
TextLineMirrorRegion
  previousRegion : TextLineMirrorRegion
[読み取り専用] テキストエレメントから派生するセット内の前の TextLineMirrorRegion。現在の領域が、セット内の最初のミラー領域である場合は null。
TextLineMirrorRegion
 Inheritedprototype : Object
[静的] クラスまたは関数オブジェクトのプロトタイプオブジェクトへの参照です。
Object
  textLine : TextLine
[読み取り専用] このミラー領域を含む TextLine です。
TextLineMirrorRegion
パブリックメソッド
 メソッド定義元
 Inherited
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inherited
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
 Inherited
指定されたプロパティが存在し、列挙できるかどうかを示します。
Object
 Inherited
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
 Inherited
指定されたオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのプリミティブな値を返します。
Object
プロパティの詳細
boundsプロパティ
bounds:Rectangle  [読み取り専用]

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

テキストラインを基準にするミラー領域の境界です。



実装
    public function get bounds():Rectangle
elementプロパティ 
element:ContentElement  [読み取り専用]

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

ミラー領域の派生元の ContentElement オブジェクトです。



実装
    public function get element():ContentElement

例外
IllegalOperationError — このエレメントが含まれる TextLine は無効です。
mirrorプロパティ 
mirror:EventDispatcher  [読み取り専用]

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

ミラー領域に影響を与えるイベントをミラーする先の EventDispatcher オブジェクトです。このオブジェクトは、ミラー領域で特に発生するマウスイベントと、テキスト行がターゲットになる他のすべてのイベントを含みます。



実装
    public function get mirror():EventDispatcher
nextRegionプロパティ 
nextRegion:TextLineMirrorRegion  [読み取り専用]

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

テキストエレメントから派生するセット内の次の TextLineMirrorRegion。これが、セット内の最後のミラー領域である場合は null。同じ行または別のテキスト行にあります。



実装
    public function get nextRegion():TextLineMirrorRegion
previousRegionプロパティ 
previousRegion:TextLineMirrorRegion  [読み取り専用]

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

テキストエレメントから派生するセット内の前の TextLineMirrorRegion。現在の領域が、セット内の最初のミラー領域である場合は null。同じ行または別のテキスト行にあります。



実装
    public function get previousRegion():TextLineMirrorRegion
textLineプロパティ 
textLine:TextLine  [読み取り専用]

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

このミラー領域を含む TextLine です。



実装
    public function get textLine():TextLine
例の使用法
TextLineMirrorRegionExample.as

この例は、ミラー領域のあるテキストのブロックを示しています。この領域をクリックすると赤色に表示されます。

package {

    import flash.display.Sprite;
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextLine;
    import flash.text.engine.TextElement;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.FontDescription;
    import flash.text.engine.ContentElement;
    import flash.text.engine.GroupElement;
    import flash.text.engine.TextLineMirrorRegion;
    import flash.events.MouseEvent;
    import flash.events.EventDispatcher;
    import flash.ui.Mouse;

    public class TextLineMirrorRegionExample extends Sprite {
        
        var myEvent:EventDispatcher = new EventDispatcher();
        var fontDescription:FontDescription = new FontDescription();
        var textBlock:TextBlock = new TextBlock();

        public function TextLineMirrorRegionExample():void {
            
            fontDescription.fontWeight = "bold";
            var blackFormat:ElementFormat = new ElementFormat();
            blackFormat.fontSize = 18;
            blackFormat.color = 0x000000;
            blackFormat.fontDescription = fontDescription;
            
            var textElement1 = new TextElement("Click on different parts of me to find the ", blackFormat);
            var textElement2 = new TextElement("mirror regions",blackFormat);
            var textElement3 = new TextElement(". If I am a mirror region, I'll ",blackFormat);
            var textElement4 = new TextElement("turn red",blackFormat);
            var textElement5 = new TextElement(".",blackFormat);
            
            myEvent.addEventListener("click", clickHandler);
            myEvent.addEventListener("mouseOut", mouseOutHandler);
            myEvent.addEventListener("mouseOver", mouseOverHandler);
            
            var groupVector:Vector.<ContentElement> = new Vector.<ContentElement>;
            groupVector.push(textElement1, textElement2, textElement3, textElement4, textElement5);
            var groupElement:GroupElement = new GroupElement(groupVector);
            
            textElement2.eventMirror=myEvent;
            textElement4.eventMirror=myEvent;
            
            textBlock.content = groupElement;
            createLines(textBlock);
        }
    
        private function clickHandler(event:MouseEvent):void
        {
            var redFormat:ElementFormat = new ElementFormat();
            redFormat.color = 0xCC0000;
            redFormat.fontSize = 18;
            redFormat.fontDescription = fontDescription;
            var line:TextLine = event.target as TextLine;
            var region:TextLineMirrorRegion = line.getMirrorRegion(myEvent);
            region.element.elementFormat = redFormat;
            createLines(textBlock);
        }
        
        private function mouseOverHandler(event:MouseEvent):void
        {
            Mouse.cursor = "button";
        }
        
        private function mouseOutHandler(event:MouseEvent):void
        {
            Mouse.cursor = "arrow";
        }
            
        private function createLines(textBlock:TextBlock):void 
        {
            var purgeLine:TextLine = textBlock.firstLine;
                
            while (purgeLine)
            {
                removeChild (purgeLine);
                purgeLine = purgeLine.nextLine;
            }
            var lineWidth:Number = 150;
            var xPos:Number = 15.0;
            var yPos:Number = 20.0;
            var textLine:TextLine = textBlock.createTextLine (null, lineWidth);
                
            while (textLine)
            {
                textLine.x = xPos;
                textLine.y = yPos;
                yPos += textLine.height + 2;
                addChild (textLine);
                textLine = textBlock.createTextLine (textLine, lineWidth);
            }
        }
    }
}




 

 

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

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