| 包 | 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 对象)的活动字符格式属性。 | Configuration | ||
| defaultLinkHoverFormat : flashx.textLayout.formats:ITextLayoutFormat
指定当光标悬停在文本流中的链接 (LinkElement) 上时,应用于该链接的初始字符格式属性。 | Configuration | ||
| defaultLinkNormalFormat : flashx.textLayout.formats:ITextLayoutFormat
指定用于文本流中所有 LinkElement 对象的初始链接属性。 | Configuration | ||
| defaultListMarkerFormat : IListMarkerFormat
指定最初适用于文本流中所有 ListItem 的活动字符格式属性。 | 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 处理并将其转换为 Tab 触发的面板事件。 | Configuration | ||
| overflowPolicy : String
一种策略,用于确定容器的最后一行是位于容器内,还是溢出到容器外。 | Configuration | ||
| releaseLineCreationData : Boolean 要求合成文本的过程在合成每个段落之后释放行创建数据。 | Configuration | ||
| scrollDragDelay : Number
指定在一个滚动与下一个滚动之间发生时间延迟,以避免滚动速度过快。 | Configuration | ||
| scrollDragPixels : Number 指定当用户通过拖动选择部分来启动自动滚动时,所滚动的默认像素数。 | Configuration | ||
| scrollMouseWheelMultiplier : Number 指定鼠标滚轮事件所滚动的默认像素数。 | 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 对象)的活动字符格式属性。对于没有指定这些属性值的新 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 |
指定最初适用于文本流中所有 ListItem 的活动字符格式属性。对于没有指定这些属性值的新 ListItemElement 对象,这些是默认值。
默认值为 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 | () | 构造函数 |
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, 11:04 AM Z
隐藏继承的公共属性
显示继承的公共属性