| パッケージ | flashx.textLayout.events |
| クラス | public class TextLayoutEvent |
| 継承 | TextLayoutEvent Event Object |
| サブクラス | ScrollEvent |
| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5 |
TextLayoutEvent.SCROLL イベントなどのイベントを表します。
スクロールイベントは、type プロパティが TextLayoutEvent.SCROLL に設定された TextLayoutEvent インスタンスによって表されます。スクロールイベントには、固有のイベントクラスを持つ他のイベントのようなカスタムプロパティがないため、スクロールイベント固有のクラスは不要です。新規 Text Layout イベントにカスタムプロパティが不要な場合、このイベントは TextLayoutEvent オブジェクトによって表されますが、type プロパティは新規の静的定数に設定されます。
| メソッド | 定義元 | ||
|---|---|---|---|
TextLayoutEvent クラスは、多数の Text Layout イベントのためにイベントリスナーに渡されるイベントオブジェクトを表します。 | TextLayoutEvent | ||
![]() |
Event サブクラスのインスタンスを複製します。 | Event | |
![]() |
カスタム ActionScript 3.0 Event クラスに toString() メソッドを実装するためのユーティリティ関数です。 | Event | |
![]() |
オブジェクトに指定されたプロパティが定義されているかどうかを示します。 | Object | |
![]() |
イベントで preventDefault() メソッドが呼び出されたかどうかを確認します。 | Event | |
![]() |
Object クラスのインスタンスが、パラメーターとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。 | Object | |
![]() |
イベントのデフォルト動作をキャンセルできる場合に、その動作をキャンセルします。 | Event | |
![]() |
指定されたプロパティが存在し、列挙できるかどうかを示します。 | Object | |
![]() |
ループ処理に対するダイナミックプロパティの可用性を設定します。 | Object | |
![]() |
イベントフローの現在のノードおよび後続するノードで、イベントリスナーが処理されないようにします。 | Event | |
![]() |
イベントフローの現在のノードに後続するノードで、イベントリスナーが処理されないようにします。 | Event | |
![]() |
ロケール固有の規則に従って書式設定された、このオブジェクトのストリング表現を返します。 | Object | |
![]() |
Event オブジェクトのすべてのプロパティを含むストリングを返します。 | Event | |
![]() |
指定されたオブジェクトのプリミティブな値を返します。 | Object | |
| 定数 | 定義元 | ||
|---|---|---|---|
| SCROLL : String = "scroll" [静的]
TextLayoutEvent.SCROLL 定数により、スクロールイベントのイベントオブジェクトの type プロパティ値が定義されます。 | TextLayoutEvent | ||
TextLayoutEvent | () | コンストラクター |
public function TextLayoutEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5 |
TextLayoutEvent クラスは、多数の Text Layout イベントのためにイベントリスナーに渡されるイベントオブジェクトを表します。
パラメーターtype:String | |
bubbles:Boolean (default = false) | |
cancelable:Boolean (default = false) |
SCROLL | 定数 |
public static const SCROLL:String = "scroll"| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | Flash Player 10, AIR 1.5 |
TextLayoutEvent.SCROLL 定数により、scroll イベントのイベントオブジェクトの type プロパティ値が定義されます。
addEventListener() メソッドの呼び出しと、イベントハンドラー関数の作成です。
TextFlow インスタンスで addEventListener() メソッドを呼び出します。単純なストリング "text" を使用できますが、静的定数 TextLayoutEvent.SCROLL を使用したほうが安全です。
この例では、イベントハンドラー関数に scrollEventHandler() という名前が付けられています。イベントハンドラーは、スクロールイベントが検出されるたびに trace() ステートメントを実行します。この例にスクロールバーは含まれていませんが、ユーザーがテキストをハイライトして、コンテナの下部を越えてカーソルをドラッグした場合に、テキストがスクロールされます。
package flashx.textLayout.events.examples {
import flash.display.Sprite;
import flash.events.Event;
import flashx.textLayout.compose.StandardFlowComposer;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.events.TextLayoutEvent;
import flashx.undo.UndoManager;
public class TextLayoutEvent_example extends Sprite
{
private const textMarkup:String = "<flow:TextFlow xmlns:flow='http://ns.adobe.com/textLayout/2008' fontSize='14' " +
"textIndent='10' paragraphSpaceBefore='6' paddingTop='8' paddingLeft='8' paddingRight='8'>" +
"<flow:p paragraphSpaceBefore='inherit'>" +
"<flow:span>There are many </flow:span>" +
"<flow:span fontStyle='italic'>such</flow:span>" +
"<flow:span> lime-kilns in that tract of country, for the purpose of burning the white" +
" marble which composes a large part of the substance of the hills. Some of them, built " +
"years ago, and long deserted, with weeds growing in the vacant round of the interior, " +
"which is open to the sky, and grass and wild-flowers rooting themselves into the chinks" +
"of the stones, look already like relics of antiquity, and may yet be overspread with the" +
" lichens of centuries to come. Others, where the lime-burner still feeds his daily and " +
"nightlong fire, afford points of interest to the wanderer among the hills, who seats " +
"himself on a log of wood or a fragment of marble, to hold a chat with the solitary man. " +
"It is a lonesome, and, when the character is inclined to thought, may be an intensely " +
"thoughtful occupation; as it proved in the case of Ethan Brand, who had mused to such " +
"strange purpose, in days gone by, while the fire in this very kiln was burning.</flow:span>" +
"</flow:p>" +
"</flow:TextFlow>";
public function TextLayoutEvent_example()
{
// create the TextFlow, container, and container controller
var textFlow:TextFlow;
var container:Sprite = new Sprite();
var _controller:ContainerController = new ContainerController(container, 200, 100);
// import the text flow from markup using TextFilter and assign a StandardFlowComposer
textFlow = TextConverter.importToFlow(textMarkup, TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.flowComposer = new StandardFlowComposer();
// create undo, edit and interaction managers
var _undoManager:UndoManager = new UndoManager();
var _editManager:EditManager = new EditManager(_undoManager);
textFlow.interactionManager = _editManager;
// Add container to display list
addChild(container);
container.x = 25;
container.y = 100;
// Add an event listener for the TextLayoutEvent.SCROLL event
textFlow.addEventListener(TextLayoutEvent.SCROLL, scrollEventHandler);
// add the controller to the text flow and update it to display the text
textFlow.flowComposer.addController(_controller);
textFlow.flowComposer.updateAllControllers();
}
private function scrollEventHandler(evt:Event):void {
trace ("scroll event occurred");
}
}
}
Tue Jun 12 2018, 10:34 AM Z
継承されるパブリックプロパティを隠す
継承されるパブリックプロパティを表示