| パッケージ | flash.text.engine |
| クラス | public final class TextLineMirrorRegion |
| 継承 | TextLineMirrorRegion Object |
| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5, Flash Lite 4 |
テキスト行に対する通常のイベント送出処理が終了した後で、テキスト行が有効で、イベント通知が停止していない場合は、テキスト行のミラー領域にイベントが送出されます。
マウスイベントのミラーは特殊なケースです。ミラー領域は実際には表示オブジェクトではないので、mouseOver イベントと mouseOut イベントはシミュレートされます。rollOver イベントと rollOut イベントはシミュレートされません。自然に発生するすべての mouseOver イベント、mouseOut イベント、rollOver イベントおよび rollOut イベントは、そのターゲットがテキスト行であるか、テキスト行の子であるかに関係なしに無視され、ミラーされません。
ActionScript コードから直接 TextLineMirrorRegion オブジェクトを作成することはできません。new TextLineMirrorRegion() を呼び出すと、例外がスローされます。TextLineMirrorRegion は、テキスト行が mirror イベントを設定した ContentElement オブジェクトから作成された際に作成され、テキスト行に関連付けられます。
TextLineMirrorRegion クラスは final クラスであるため、サブクラス化することはできません。
関連する API エレメント
| プロパティ | 定義元 | ||
|---|---|---|---|
| bounds : Rectangle [読み取り専用]
テキストラインを基準にするミラー領域の境界です。 | TextLineMirrorRegion | ||
![]() | constructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクター関数への参照です。 | Object | |
| element : ContentElement [読み取り専用]
ミラー領域の派生元の ContentElement オブジェクトです。 | TextLineMirrorRegion | ||
| mirror : EventDispatcher [読み取り専用]
ミラー領域に影響を与えるイベントをミラーする先の EventDispatcher オブジェクトです。 | TextLineMirrorRegion | ||
| nextRegion : flash.text.engine:TextLineMirrorRegion [読み取り専用]
テキストエレメントから派生するセット内の次の TextLineMirrorRegion。現在の領域が、セット内の最後のミラー領域である場合は null。 | TextLineMirrorRegion | ||
| previousRegion : flash.text.engine:TextLineMirrorRegion [読み取り専用]
テキストエレメントから派生するセット内の前の TextLineMirrorRegion。現在の領域が、セット内の最初のミラー領域である場合は null。 | TextLineMirrorRegion | ||
| textLine : flash.text.engine:TextLine [読み取り専用]
このミラー領域を含む TextLine です。 | TextLineMirrorRegion | ||
bounds | プロパティ |
element | プロパティ |
element:ContentElement [読み取り専用] | 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5, Flash Lite 4 |
ミラー領域の派生元の ContentElement オブジェクトです。
実装
public function get element():ContentElement例外
IllegalOperationError — このエレメントが含まれる TextLine は無効です。
|
mirror | プロパティ |
mirror:EventDispatcher [読み取り専用] | 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5, Flash Lite 4 |
ミラー領域に影響を与えるイベントをミラーする先の EventDispatcher オブジェクトです。このオブジェクトは、ミラー領域で特に発生するマウスイベントと、テキスト行がターゲットになる他のすべてのイベントを含みます。
実装
public function get mirror():EventDispatchernextRegion | プロパティ |
nextRegion:flash.text.engine:TextLineMirrorRegion [読み取り専用] | 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5, Flash Lite 4 |
テキストエレメントから派生するセット内の次の TextLineMirrorRegion。これが、セット内の最後のミラー領域である場合は null。同じ行または別のテキスト行にあります。
実装
public function get nextRegion():flash.text.engine:TextLineMirrorRegionpreviousRegion | プロパティ |
previousRegion:flash.text.engine:TextLineMirrorRegion [読み取り専用] | 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5, Flash Lite 4 |
テキストエレメントから派生するセット内の前の TextLineMirrorRegion。現在の領域が、セット内の最初のミラー領域である場合は null。同じ行または別のテキスト行にあります。
実装
public function get previousRegion():flash.text.engine:TextLineMirrorRegiontextLine | プロパティ |
textLine:flash.text.engine:TextLine [読み取り専用] | 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5, Flash Lite 4 |
このミラー領域を含む TextLine です。
実装
public function get textLine():flash.text.engine:TextLine
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);
}
}
}
}
Tue Jun 12 2018, 10:34 AM Z
継承されるパブリックプロパティを隠す
継承されるパブリックプロパティを表示