| 패키지 | flashx.textLayout.events |
| 클래스 | public class TextLayoutEvent |
| 상속 | TextLayoutEvent Event Object |
| 하위 클래스 | ScrollEvent |
| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
TextLayoutEvent.SCROLL 이벤트와 같이 사용자 정의 속성을 요구하지 않는 이벤트를 나타냅니다.
스크롤 이벤트는 TextLayoutEvent 인스턴스를 사용하여 나타내며 type 속성은 TextLayoutEvent.SCROLL로 설정됩니다. 스크롤 이벤트는 고유한 이벤트 클래스를 갖는 다른 이벤트를 위한 용도로, 사용자 정의 속성이 없으므로 스크롤 이벤트 전용 클래스가 필요하지 않습니다. 사용자 정의 속성을 요구하지 않는 새 텍스트 레이아웃 이벤트가 필요한 경우 type 속성이 새로운 정적 상수로 설정된 TextLayoutEvent 객체를 사용하여 해당 이벤트를 나타냅니다.
| 메서드 | 정의 주체 | ||
|---|---|---|---|
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 상수는 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, 03:17 PM Z
상속되는 공용 속성 숨기기
상속되는 공용 속성 표시