| 패키지 | flashx.textLayout.events |
| 클래스 | public class FlowOperationEvent |
| 상속 | FlowOperationEvent Event Object |
| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
작업이 수행되기 전에 TextFlow 객체에서 FlowOperationEvent를 전달하며, 이때 type 속성은 FlowOperationEvent.FLOW_OPERATION_BEGIN으로 설정되어 있습니다. operation 속성을 확인하여 시작할 작업의 유형을 알아볼 수 있습니다. FLOW_OPERATION_BEGIN 유형의 이벤트는 취소할 수 있습니다. 즉, 작업을 더 이상 진행하지 않으려면 Event.PreventDefault()를 호출하여 작업을 취소할 수 있습니다. 작업을 취소하면 작업이 수행되지 않으며 FLOW_OPERATION_END 이벤트도 전달되지 않습니다. 또한 이벤트를 트리거한 작업이 완료되기 전에 EditManager로 콜백하여 또 다른 작업을 수행하도록 선택할 수도 있습니다. 이렇게 하면 이벤트 핸들러에서 시작한 작업은 이벤트를 트리거한 작업과 함께 단일 작업으로 실행 취소됩니다.
작업을 계속하도록 허용한 경우 작업 완료 시 TextFlow에서 type 속성이 FlowOperationEvent.FLOW_OPERATION_END로 설정된 FlowOperationEvent를 전달합니다. Flash Player에서 작업의 결과로 발생된 오류를 throw하기 전에 이 이벤트가 전달됩니다. 따라서 Flash Player에서 오류를 throw하기 전에 오류를 처리할 수 있습니다. 이벤트의 error 속성을 통해 이 오류에 액세스할 수 있습니다. 이벤트 핸들러에서 오류를 처리하려는 경우 Event.preventDefault()를 호출하여 FLOW_OPERATION_END 이벤트를 취소하는 방법으로 Flash Player에서 오류를 throw하지 못하도록 방지할 수 있습니다. 또한 EditManager로 콜백하여 추가 작업을 수행하도록 선택할 수도 있습니다. 이렇게 하면 결과 작업이 이벤트를 트리거한 작업과 함께 하나의 단위로 실행 취소됩니다.
관련 API 요소
| 속성 | 정의 주체 | ||
|---|---|---|---|
![]() | bubbles : Boolean [읽기 전용]
이벤트가 버블링 이벤트인지 여부를 나타냅니다. | Event | |
![]() | cancelable : Boolean [읽기 전용]
해당 이벤트와 연관된 비헤이비어를 차단할 수 있는지 여부를 나타냅니다. | Event | |
![]() | constructor : Object
지정된 객체 인스턴스의 클래스 객체 또는 생성자 함수에 대한 참조입니다. | Object | |
![]() | currentTarget : Object [읽기 전용]
이벤트 리스너를 통해 Event 객체를 처리하고 있는 객체입니다. | Event | |
| error : Error
작업 중 throw된 오류입니다. | FlowOperationEvent | ||
![]() | eventPhase : uint [읽기 전용]
이벤트 흐름에서 현재 단계입니다. | Event | |
| level : int
중첩을 통해 작업이 구성 작업으로 병합될 수 있습니다. | FlowOperationEvent | ||
| operation : FlowOperation
막 시작되는 또는 방금 종료된 작업입니다. | FlowOperationEvent | ||
![]() | target : Object [읽기 전용]
이벤트 대상입니다. | Event | |
![]() | type : String [읽기 전용]
이벤트 유형입니다. | Event | |
| 메서드 | 정의 주체 | ||
|---|---|---|---|
FlowOperationEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, operation:FlowOperation = null, level:int = 0, error:Error = null) 흐름 작업에 대한 정보가 포함된 이벤트 객체를 만듭니다. | FlowOperationEvent | ||
![]() |
Event 하위 클래스의 인스턴스를 복제합니다. | Event | |
![]() |
사용자 정의 ActionScript 3.0 Event 클래스에서 toString() 메서드를 구현하기 위한 유틸리티 함수입니다. | Event | |
![]() |
지정된 속성이 객체에 정의되어 있는지 여부를 나타냅니다. | Object | |
![]() |
이벤트에서 preventDefault() 메서드가 호출되었는지 여부를 확인합니다. | Event | |
![]() |
Object 클래스의 인스턴스가 매개 변수로 지정된 객체의 프로토타입 체인에 있는지 여부를 나타냅니다. | Object | |
![]() |
이벤트의 기본 비헤이비어를 취소할 수 있는 경우, 그 비헤이비어를 취소합니다. | Event | |
![]() |
지정된 속성이 존재하고 열거 가능한지 여부를 나타냅니다. | Object | |
![]() |
루프 작업에서 동적 속성을 사용할 수 있는지 여부를 설정합니다. | Object | |
![]() |
이벤트 흐름에서 현재 노드 및 그 후속 노드에 있는 모든 이벤트 리스너가 처리되지 않도록 합니다. | Event | |
![]() |
이벤트 흐름에서 현재 노드의 후속 노드에 있는 모든 이벤트 리스너가 처리되지 않도록 합니다. | Event | |
![]() |
로캘별 규칙에 따라 서식이 지정된 이 객체의 문자열 표현을 반환합니다. | Object | |
![]() |
Event 객체의 속성이 모두 포함된 문자열을 반환합니다. | Event | |
![]() |
지정된 객체의 프리미티브 값을 반환합니다. | Object | |
| 상수 | 정의 주체 | ||
|---|---|---|---|
| FLOW_OPERATION_BEGIN : String = "flowOperationBegin" [정적]
flowOperationBegin 이벤트 객체의 type 속성 값을 정의합니다. | FlowOperationEvent | ||
| FLOW_OPERATION_COMPLETE : String = "flowOperationComplete" [정적]
flowOperationComplete 이벤트 객체의 type 속성 값을 정의합니다. | FlowOperationEvent | ||
| FLOW_OPERATION_END : String = "flowOperationEnd" [정적]
flowOperationEnd 이벤트 객체의 type 속성 값을 정의합니다. | FlowOperationEvent | ||
error | 속성 |
error:Error| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
작업 중 throw된 오류입니다. 작업 중 오류가 발생하면 오류 객체에 대한 참조가 FLOW_OPERATION_END 이벤트에 연결됩니다. 따라서 Flash Player에서 오류를 throw하기 전에 오류를 처리할 수 있습니다. 이벤트를 취소하면 Flash Player에서 오류를 throw하지 않습니다.
구현
public function get error():Error public function set error(value:Error):voidlevel | 속성 |
operation | 속성 |
operation:FlowOperation| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
막 시작되는 또는 방금 종료된 작업입니다.
구현
public function get operation():FlowOperation public function set operation(value:FlowOperation):void관련 API 요소
FlowOperationEvent | () | 생성자 |
public function FlowOperationEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, operation:FlowOperation = null, level:int = 0, error:Error = null)| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
흐름 작업에 대한 정보가 포함된 이벤트 객체를 만듭니다.
매개 변수type:String — 이벤트 유형입니다. 이벤트 리스너는 상속된 type 속성을 통해 이 정보에 액세스할 수 있습니다. 유형으로는 FlowOperationEvent.FLOW_OPERATION_BEGIN과 FlowOperationEvent.FLOW_OPERATION_END 두 가지가 있습니다.
| |
bubbles:Boolean (default = false) — 이벤트가 버블링 이벤트인지 여부를 나타냅니다. 이 이벤트는 버블링 이벤트가 아닙니다.
| |
cancelable:Boolean (default = false) — 해당 이벤트와 연관된 비헤이비어를 차단할 수 있는지 여부를 나타냅니다. 이 이벤트는 이벤트 핸들러 함수에서 Event.preventDefault() 메서드를 호출하여 취소할 수 있습니다.
| |
operation:FlowOperation (default = null) — 막 시작되는 또는 방금 종료된 FlowOperation입니다.
| |
level:int (default = 0) — 작업 중에 발생하는 오류입니다.
| |
error:Error (default = null) |
FLOW_OPERATION_BEGIN | 상수 |
public static const FLOW_OPERATION_BEGIN:String = "flowOperationBegin"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
flowOperationBegin 이벤트 객체의 type 속성 값을 정의합니다. 작업이 실행되기 전에 전달됩니다. 이 이벤트를 취소하면 작업이 실행되지 않습니다.
FLOW_OPERATION_COMPLETE | 상수 |
public static const FLOW_OPERATION_COMPLETE:String = "flowOperationComplete"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
flowOperationComplete 이벤트 객체의 type 속성 값을 정의합니다. 대기 중인 작업과 구성 작업을 포함하여 모든 작업이 완료되고 구성을 마치고 표시가 스크롤된 후 전달됩니다.
FLOW_OPERATION_END | 상수 |
public static const FLOW_OPERATION_END:String = "flowOperationEnd"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
flowOperationEnd 이벤트 객체의 type 속성 값을 정의합니다. 작업이 완료된 후에 전달됩니다. 오류는 OperationEvent.error에 저장됩니다. 오류가 발생한 경우 이 이벤트를 취소하면 오류가 다시 throw되지 않습니다. 일반적으로 모든 오류는 치명적일 수 있습니다.
작업이 실행된 후에는 작업을 변경할 수 없습니다.
이 예제에서는 텍스트 흐름 작업의 시작과 끝을 수신하는 이벤트 핸들러를 만드는 방법을 보여 줍니다. 두 가지 주요 단계는 텍스트 흐름에서 addEventListener() 메서드를 호출하는 단계와 이벤트 핸들러 함수를 만드는 단계로 구성됩니다.
TextFlow 인스턴스에 대해 addEventListener()가 호출됩니다. "flowOperationBegin" 또는 "flowOperationEnd"와 같은 단순한 문자열을 사용할 수도 있지만 FlowOperationEvent.FLOW_OPERATION_BEGIN 또는 FlowOperationEvent.FLOW_OPERATION_END와 같은 정적 상수를 각각 사용하는 것이 더 안전합니다.
이 예에서 이벤트 핸들러 함수의 이름은 opBeginHandler() 및 opEndHandler()입니다. opBeginHandler() 메서드는 trace() 함수를 사용하여 붙여넣기 작업이 시작되었음을 나타내는 trace 문을 생성합니다. opEndHandler() 메서드도 trace() 함수를 사용하지만 오류가 발생하는 경우에만 trace 문을 생성합니다.
package flashx.textLayout.events.examples
{
import flash.display.Sprite;
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.FlowOperationEvent;
import flashx.textLayout.operations.FlowOperation;
import flashx.textLayout.operations.PasteOperation;
import flashx.undo.UndoManager;
public class FlowOperationEvent_example extends Sprite
{
private var inputContainer:Sprite;
private var inputTextFlow:TextFlow;
private var inputController:ContainerController;
private var inputEditManager:EditManager;
private var inputUndoManager:UndoManager;
public function FlowOperationEvent_example()
{
var replaceText:String = "paste text here";
inputTextFlow = new TextFlow();
inputContainer = new Sprite();
inputContainer.x = 30;
inputContainer.y = 100;
this.stage.addChild( inputContainer );
inputController = new ContainerController(inputContainer, 225, 20);
inputController.verticalScrollPolicy = flashx.textLayout.container.ScrollPolicy.OFF;
inputTextFlow = TextConverter.importToFlow(replaceText, TextConverter.PLAIN_TEXT_FORMAT);
inputTextFlow.flowComposer = new StandardFlowComposer();
inputTextFlow.flowComposer.addController(inputController);
inputUndoManager = new UndoManager();
inputEditManager = new EditManager(inputUndoManager);
inputTextFlow.interactionManager = inputEditManager;
inputTextFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_BEGIN, opBeginHandler);
inputTextFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_END, opEndHandler);
inputTextFlow.flowComposer.updateAllControllers();
}
private function opBeginHandler(evt:FlowOperationEvent):void {
var flowOp:FlowOperation = evt.operation;
if(flowOp is PasteOperation) {
trace("You can cancel or modify the paste operation in this event handler.");
}
}
private function opEndHandler(evt:FlowOperationEvent):void {
var flowOp:FlowOperation = evt.operation;
if(evt.error) {
trace("You can handle the error here and call preventDefault().");
}
}
}
}
Tue Jun 12 2018, 03:17 PM Z
상속되는 공용 속성 숨기기
상속되는 공용 속성 표시