| 套件 | flashx.textLayout.elements |
| 類別 | public class Configuration |
| 繼承 | Configuration Object |
| 實作 | IConfiguration |
| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
TextFlow() 建構函式的參數。它允許應用程式控制 Text Layout Framework 的初始行為。
Configuration 類別可讓您透過 textFlowInitialFormat 屬性來指定文字流排的初始、段落及容器格式。它也可讓您指定連結、選取、捲動以及處理 Tab 和 Enter 鍵的初始格式屬性。
更多範例
相關 API 元素
| 屬性 | 定義自 | ||
|---|---|---|---|
![]() | constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | |
| defaultLinkActiveFormat : flashx.textLayout.formats:ITextLayoutFormat
指定文字流排中所有連結 (LinkElement objects) 一開始所套用的作用中字元格式特質。 | Configuration | ||
| defaultLinkHoverFormat : flashx.textLayout.formats:ITextLayoutFormat
指定當游標停留在連結上方時,套用至文字流排之連結 (LinkElement) 的初始字元格式特質。 | Configuration | ||
| defaultLinkNormalFormat : flashx.textLayout.formats:ITextLayoutFormat
指定文字流排中所有 LinkElement 物件的初始連結特質。 | Configuration | ||
| defaultListMarkerFormat : IListMarkerFormat
指定文字流排中所有 ListItems 一開始所套用的作用中字元格式特質。 | Configuration | ||
| enableAccessibility : Boolean
指定開啟或關閉輔助功能支援。 | Configuration | ||
| flowComposerClass : Class 指定預設附加至新 TextFlow 物件的文字流排撰寫器類型。 | Configuration | ||
| focusedSelectionFormat : SelectionFormat
在視窗具有焦點時,文字流排 (TextFlow) 的初始選取範圍格式 (SelectionFormat)。 | Configuration | ||
| inactiveSelectionFormat : SelectionFormat
視窗未作用時,文字流排 (TextFlow) 的初始選取範圍格式 (SelectionFormat)。 | Configuration | ||
| inlineGraphicResolverFunction : Function 指定用於解析內嵌圖形元素的回呼。 | Configuration | ||
| manageEnterKey : Boolean
指定 Enter/Return 鍵要由 Text Layout Framework 輸入為文字 (例如用來分割段落),還是由用戶端程式碼來處理。 | Configuration | ||
| manageTabKey : Boolean
指定 TAB 鍵要由 Text Layout Framework 輸入為文字,還是由 Flash Player 或 AIR 來處理,並將它轉換為定位點面板事件。 | Configuration | ||
| overflowPolicy : String
用來決定容器的最後一行是否可以放入容器中,或是否會溢位的原則。 | Configuration | ||
| releaseLineCreationData : Boolean 處理撰寫文字的要求,會在撰寫每個段落之後釋出行建立資料。 | Configuration | ||
| scrollDragDelay : Number
指定捲動與下一個捲動之間的延遲時間,防止捲動的速度過快。 | Configuration | ||
| scrollDragPixels : Number 指定使用者拖曳選取範圍以啟動自動捲動時,預設的捲動像素數。 | Configuration | ||
| scrollMouseWheelMultiplier : Number 指定 Mouse wheel 事件的預設捲動像素數。 | Configuration | ||
| scrollPagePercentage : Number
針對頁面捲動,指定文字流排預設的捲動百分比。 | Configuration | ||
| textFlowInitialFormat : flashx.textLayout.formats:ITextLayoutFormat
指定文字流排 (TextFlow 物件) 的初始格式 TextLayoutFormat 組態。 | Configuration | ||
| unfocusedSelectionFormat : SelectionFormat
當視窗作用中,但 TextFlow 中的容器沒有焦點時,Text Layout Framework 用來繪製選取範圍的初始選取格式。 | Configuration | ||
| 方法 | 定義自 | ||
|---|---|---|---|
Configuration(initializeWithDefaults:Boolean = true) 建構函式 - 建立預設組態。 | Configuration | ||
建立 Configuration 物件的仿製項目。 | Configuration | ||
![]() |
指出物件是否有已定義的指定屬性。 | Object | |
![]() |
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | |
![]() |
指出指定的屬性是否存在,以及是否可列舉。 | Object | |
![]() |
為迴圈作業設定動態屬性的可用性。 | Object | |
![]() |
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | |
![]() |
會傳回指定之物件的字串形式。 | Object | |
![]() |
會傳回指定之物件的基本值。 | Object | |
defaultLinkActiveFormat | 屬性 |
defaultLinkActiveFormat:flashx.textLayout.formats:ITextLayoutFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
指定文字流排中所有連結 (LinkElement objects) 一開始所套用的作用中字元格式特質。這些是未指定這些特質值之新 LinkElement 物件的預設值。
預設是 null。
實作
public function get defaultLinkActiveFormat():flashx.textLayout.formats:ITextLayoutFormat public function set defaultLinkActiveFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void相關 API 元素
defaultLinkHoverFormat | 屬性 |
defaultLinkHoverFormat:flashx.textLayout.formats:ITextLayoutFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
指定當游標停留在連結上方時,套用至文字流排之連結 (LinkElement) 的初始字元格式特質。這些是未指定這些特質值之新 LinkElement 物件的預設值。
預設是 null。
實作
public function get defaultLinkHoverFormat():flashx.textLayout.formats:ITextLayoutFormat public function set defaultLinkHoverFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void相關 API 元素
defaultLinkNormalFormat | 屬性 |
defaultLinkNormalFormat:flashx.textLayout.formats:ITextLayoutFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
指定文字流排中所有 LinkElement 物件的初始連結特質。這些是未指定這些特質值之新 LinkElement 物件的預設值。預設的標準格式會以藍色顯示連結並加上底線。
實作
public function get defaultLinkNormalFormat():flashx.textLayout.formats:ITextLayoutFormat public function set defaultLinkNormalFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void相關 API 元素
defaultListMarkerFormat | 屬性 |
defaultListMarkerFormat:IListMarkerFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
指定文字流排中所有 ListItems 一開始所套用的作用中字元格式特質。這些是未指定這些特質值之新 ListItemElements 物件的預設值。
預設是 null。
實作
public function get defaultListMarkerFormat():IListMarkerFormat public function set defaultListMarkerFormat(value:IListMarkerFormat):void相關 API 元素
enableAccessibility | 屬性 |
flowComposerClass | 屬性 |
focusedSelectionFormat | 屬性 |
focusedSelectionFormat:SelectionFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
在視窗具有焦點時,文字流排 (TextFlow) 的初始選取範圍格式 (SelectionFormat)。當視窗作用中,且 TextFlow 中的其中一個容器具有焦點時,Text Layout Framework 會使用 focusedSelectionFormat 來繪製選取範圍。您可以視需要使用 SelectionManager.focusedSelectionFormat 來覆寫此格式。
SelectionFormat 類別會指定預設值,該值會反轉文字的顏色及其背景。
實作
public function get focusedSelectionFormat():SelectionFormat public function set focusedSelectionFormat(value:SelectionFormat):void相關 API 元素
inactiveSelectionFormat | 屬性 |
inactiveSelectionFormat:SelectionFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
視窗未作用時,文字流排 (TextFlow) 的初始選取範圍格式 (SelectionFormat)。視窗未作用時,Text Layout Framework 會使用 inactiveSelectionFormat 來繪製選取範圍。您可以視需要使用 SelectionManager.inactiveSelectionFormat 來覆寫此格式。
如果未覆寫 unfocusedSelectionFormat,則使用的 SelectionFormat 值為:
color = 0xffffff(白色)alpha = 0blendMode = flash.display.BlendMode.DIFFERENCE
結果是不會顯示任何選取範圍。
實作
public function get inactiveSelectionFormat():SelectionFormat public function set inactiveSelectionFormat(value:SelectionFormat):void相關 API 元素
inlineGraphicResolverFunction | 屬性 |
inlineGraphicResolverFunction:Function| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
指定用於解析內嵌圖形元素的回呼。回呼接收 flashx.textLayout.elements.InlineGraphicElement 物件並傳回值,以作為元素的 flashx.textLayout.elements.InlineGraphicElement#source。此回呼提供機制以延遲提供內嵌圖形元素來源,直到撰寫來源之前。
注意:只有當設定 String 類型的預留位置來源時,才會叫用此回呼。此外,它可以多次叫用。
實作
public function get inlineGraphicResolverFunction():Function public function set inlineGraphicResolverFunction(value:Function):void相關 API 元素
manageEnterKey | 屬性 |
manageTabKey | 屬性 |
overflowPolicy | 屬性 |
overflowPolicy:String| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
用來決定容器的最後一行是否可以放入容器中,或是否會溢位的原則。請使用 OverflowPolicy 類別的常數來設定此屬性。
預設值是 OverflowPolicy.FIT_DESCENDERS,如果頂端到基線的撰寫區域足以放入該行,就可以將該行放入撰寫區域中。
實作
public function get overflowPolicy():String public function set overflowPolicy(value:String):void相關 API 元素
releaseLineCreationData | 屬性 |
scrollDragDelay | 屬性 |
scrollDragPixels | 屬性 |
scrollMouseWheelMultiplier | 屬性 |
scrollPagePercentage | 屬性 |
textFlowInitialFormat | 屬性 |
textFlowInitialFormat:flashx.textLayout.formats:ITextLayoutFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
指定文字流排 (TextFlow 物件) 的初始格式 TextLayoutFormat 組態。
預設是 null。
實作
public function get textFlowInitialFormat():flashx.textLayout.formats:ITextLayoutFormat public function set textFlowInitialFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void相關 API 元素
unfocusedSelectionFormat | 屬性 |
unfocusedSelectionFormat:SelectionFormat| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
當視窗作用中,但 TextFlow 中的容器沒有焦點時,Text Layout Framework 用來繪製選取範圍的初始選取格式。您可以視需要使用 SelectionManager.unfocusedSelectionFormat 來覆寫此格式。
如果未覆寫 unfocusedSelectionFormat,則使用的 SelectionFormat 值為:
color = 0xffffff(白色)alpha = 0blendMode = flash.display.BlendMode.DIFFERENCE
結果是不會顯示任何選取範圍。
實作
public function get unfocusedSelectionFormat():SelectionFormat public function set unfocusedSelectionFormat(value:SelectionFormat):void相關 API 元素
Configuration | () | 建構函式 |
public function Configuration(initializeWithDefaults:Boolean = true)| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
建構函式 - 建立預設組態。
參數initializeWithDefaults:Boolean (default = true) — 指定是否使用預設值來初始化設定。預設值為 true。如果設為 false,則不會使用預設值來進行初始化,因此不會用到一些物件。clone() 方法會將此項目設為 false,並從原始物件中複製屬性。
|
相關 API 元素
clone | () | 方法 |
public function clone():Configuration| 語言版本: | ActionScript 3.0 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
建立 Configuration 物件的仿製項目。
傳回值Configuration |
hasTouchScreen | 常數 |
tlf_internal static const hasTouchScreen:Boolean
package flashx.textLayout.elements.examples {
import flash.display.Sprite;
import flash.text.engine.FontPosture;
import flash.text.engine.Kerning;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.edit.SelectionFormat;
import flashx.textLayout.edit.SelectionManager;
import flashx.textLayout.elements.Configuration;
import flashx.textLayout.elements.LinkElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextAlign;
import flashx.textLayout.formats.TextDecoration;
import flashx.textLayout.formats.TextLayoutFormat;
public class ConfigurationExample extends Sprite
{
public function ConfigurationExample()
{
//create container for the text and add to stage
var textContainer:Sprite = new Sprite();
textContainer.x = 50;
textContainer.y = 20;
this.stage.addChild( textContainer );
// create Configuration, set properties for it and add to TextFlow
var config:Configuration = new Configuration();
var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
textLayoutFormat.fontFamily = "Arial, Helvetica, _sans";
textLayoutFormat.fontSize = 16;
textLayoutFormat.kerning = Kerning.ON;
textLayoutFormat.fontStyle = FontPosture.ITALIC;
textLayoutFormat.textAlign = TextAlign.CENTER;
config.textFlowInitialFormat = textLayoutFormat;
var linkNormalFormat:TextLayoutFormat = new TextLayoutFormat();
// make links red and underlined
linkNormalFormat.color = 0xFF0000;
linkNormalFormat.textDecoration = TextDecoration.UNDERLINE;
config.defaultLinkNormalFormat = linkNormalFormat;
// set selection color to light blue
var selectionFormat:SelectionFormat = new SelectionFormat(0x333300);
config.focusedSelectionFormat = selectionFormat;
var textFlow:TextFlow = new TextFlow(config);
// make text selectable
var selectionManager:SelectionManager = new SelectionManager();
textFlow.interactionManager = selectionManager;
// create paragraph, a span of text, and a link
var p:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
var linkSpan:SpanElement = new SpanElement();
var link:LinkElement = new LinkElement();
link.href = "http://www.adobe.com";
linkSpan.text = "Adobe's website";
link.addChild(linkSpan);
span.text = "The best place to go for information about Adobe products is: ";
// Add span and link to paragraph; add paragraph to TextFlow
p.addChild(span);
p.addChild(link);
textFlow.addChild(p);
// Add a controller for the container; specify container width and height
textFlow.flowComposer.addController(new ContainerController(textContainer, 80, 300));
textFlow.flowComposer.updateAllControllers();
}
}
}
Tue Jun 12 2018, 03:47 PM Z
隱藏繼承公用屬性
顯示繼承公用屬性