| 패키지 | flashx.textLayout.factory |
| 클래스 | public class TextFlowTextLineFactory |
| 상속 | TextFlowTextLineFactory TextLineFactoryBase Object |
| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
텍스트 줄은 정적이며 단일 경계 사각형에 맞게 만들어지지만 단락과 서식은 물론 인라인 그래픽도 여러 개 포함할 수 있습니다. 문자열에서 TextLine 객체를 직접 만들려면 StringTextLineFactory를 사용해야 합니다.
참고: 인라인 그래픽을 사용할 경우 InlineGraphicElement 객체의 source 속성은 포함된 에셋을 나타내는 DisplayObject 또는 Class 객체의 인스턴스여야 합니다. URLRequest 객체는 사용할 수 없습니다. 줄이 만들어질 당시 인라인 그래픽의 폭과 높이가 흐름을 컴포지션하는 데 사용됩니다.
관련 API 요소
공용 속성
공용 메서드
| 메서드 | 정의 주체 | ||
|---|---|---|---|
TextFlowTextLineFactory 객체를 만듭니다. | TextFlowTextLineFactory | ||
지정된 텍스트 흐름에서 TextLine 객체를 만듭니다. | TextFlowTextLineFactory | ||
![]() |
배치되는 내용이 들어갈 가장 작은 사각형입니다. | TextLineFactoryBase | |
![]() |
지정된 속성이 객체에 정의되어 있는지 여부를 나타냅니다. | Object | |
![]() |
Object 클래스의 인스턴스가 매개 변수로 지정된 객체의 프로토타입 체인에 있는지 여부를 나타냅니다. | Object | |
![]() |
지정된 속성이 존재하고 열거 가능한지 여부를 나타냅니다. | Object | |
![]() |
루프 작업에서 동적 속성을 사용할 수 있는지 여부를 설정합니다. | Object | |
![]() |
로캘별 규칙에 따라 서식이 지정된 이 객체의 문자열 표현을 반환합니다. | Object | |
![]() |
지정된 객체의 문자열 표현을 반환합니다. | Object | |
![]() |
지정된 객체의 프리미티브 값을 반환합니다. | Object | |
생성자 세부 정보
TextFlowTextLineFactory | () | 생성자 |
public function TextFlowTextLineFactory()| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
TextFlowTextLineFactory 객체를 만듭니다.
메서드 세부 정보
createTextLines | () | 메서드 |
public function createTextLines(callback:Function, textFlow:flashx.textLayout.elements:TextFlow):void| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | Flash Player 10, AIR 1.5 |
지정된 텍스트 흐름에서 TextLine 객체를 만듭니다.
텍스트 줄은 compositionBounds 속성에 지정된 경계에 맞게 컴포지션됩니다. 각 줄이 만들어질 때 팩토리는 callback 매개 변수에 지정된 함수를 호출합니다. 이 함수에 TextLine 객체가 전달되며, 이 함수는 줄을 표시하는 역할을 합니다. 줄에 배경색이 있는 경우 팩토리는 배경색의 사각형이 포함된 Shape 객체와 함께 콜백 함수를 호출합니다.
팩토리의 스크롤 정책은 생성되는 줄 수를 제어합니다.
매개 변수
callback:Function — 생성된 각 TextLine 객체와 함께 호출되는 함수입니다. 이 콜백 함수는 배경색(있는 경우)을 나타내는 Shape 객체 및 텍스트의 TextLine 객체와 함께 호출됩니다.
| |
textFlow:flashx.textLayout.elements:TextFlow — 줄이 만들어지는 TextFlow입니다.
|
예제 예제 사용 방법
TextFlowTextLineFactory_example.as
다음 예에서는 TextFlowTextLineFactory를 사용하여 텍스트 줄 집합을 만듭니다. 팩토리 메서드
createTextLines()가 동일한 구문을 사용하여 두 번 호출됩니다. 팩토리 속성과 흐름 서식은 "그림자" 효과를 만드는 호출 사이에서 조정됩니다.
package flashx.textLayout.factory.examples
{
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.geom.Rectangle;
import flash.text.engine.TextLine;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.factory.TextFlowTextLineFactory;
import flashx.textLayout.formats.TextLayoutFormat;
public class TextFlowTextLineFactory_example extends Sprite
{
public function TextFlowTextLineFactory_example()
{
var factory:TextFlowTextLineFactory = new TextFlowTextLineFactory();
factory.compositionBounds = new Rectangle( 100, 100, 200, 130 );
var flow:TextFlow = new TextFlow();
var format:TextLayoutFormat = new TextLayoutFormat();
format.fontFamily = "LilyUPC, Verdana, _sans";
format.fontSize = 32;
format.color = 0x000000;
format.textAlpha = .5;
var span:SpanElement = new SpanElement();
span.text = "The quick brown fox jumped over the lazy dog.";
span.format = format;
var para:ParagraphElement = new ParagraphElement();
para.addChild( span );
flow.addChild( para );
factory.createTextLines( useTextLines, flow );
factory.compositionBounds = new Rectangle( 99, 99, 200, 130 );
format.color = 0x990000;
format.textAlpha = 1;
span.format = format;
factory.createTextLines( useTextLines, flow );
graphics.beginFill(0x555555,.5);
graphics.drawRect( 99, 99, 201, 131 );
graphics.endFill();
}
private function useTextLines( lineOrShape:DisplayObject ):void
{
this.addChild( lineOrShape );
}
}
}
Tue Jun 12 2018, 03:17 PM Z
상속되는 공용 속성 숨기기
상속되는 공용 속성 표시