| 包 | flashx.textLayout.edit |
| 接口 | public interface IEditManager extends ISelectionManager , IInteractionEventHandler |
| 实现器 | EditManager |
| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
要启用文本流编辑功能,请将一个 IEditManager 实例指定给 TextFlow 对象的 interactionManager 属性。编辑管理器可以处理对文本进行的更改(例如插入、删除和更改格式)。如果编辑管理器具有撤消管理器,则可以撤消这些更改。必要时,编辑管理器会触发文本流的重新合成和显示。
相关 API 元素
| 方法 | 由以下参数定义 | ||
|---|---|---|---|
![]() |
处理 activate 事件。 | IInteractionEventHandler | |
applyContainerFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
将容器样式应用于所选项目中的任何容器。 | IEditManager | ||
applyFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
更改指定(或当前)选择部分的格式。 | IEditManager | ||
applyFormatToElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
将样式应用于指定元素。 | IEditManager | ||
applyLeafFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
更改应用于指定(或当前)选择部分中叶元素的格式。 | IEditManager | ||
applyLink(href:String, target:String = null, extendToLinkBoundary:Boolean = false, operationState:SelectionState = null):LinkElement
将选择部分转换为一个链接,或将链接转换为普通文本。 | IEditManager | ||
applyParagraphFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
将段落样式应用于所选项目中的任何段落。 | IEditManager | ||
将文本转换为 TCY 串或将 TCY 串转换为非 TCY 文本。 | IEditManager | ||
开始一组新操作。 | IEditManager | ||
changeElementID(newID:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
更改元素的 ID。 | IEditManager | ||
changeStyleName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void 自以下版本起不推荐使用: 2.0: 请使用 applyFormatToElement
更改整个元素或部分元素的 styleName。 | IEditManager | ||
changeTypeName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
更改整个元素或部分元素的 typeName。 | IEditManager | ||
clearFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
对指定(或当前)所选项目的格式取消定义。 | IEditManager | ||
clearFormatOnElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
对指定元素的样式取消定义。 | IEditManager | ||
createDiv(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):DivElement 在同时包含范围的开始和结束点的最低公共父元素位置,创建包含在 operationState 中指定的整个范围的新 DivElement。 | IEditManager | ||
createList(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):ListElement 在同时包含范围的开始和结束点的最低公共父元素位置,创建包含在 operationState 中指定的整个范围的新 ListElement。 | IEditManager | ||
createSubParagraphGroup(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):SubParagraphGroupElement 在同时包含范围的开始和结束点的最低公共父元素位置,创建包含在 operationState 中指定的整个范围的新 SubParagraphGroupElement。 | IEditManager | ||
删除选择的区域并在 TextScrap 对象中返回删除的区域。 | IEditManager | ||
![]() |
处理 deactivate 事件。 | IInteractionEventHandler | |
删除某一范围内的文本,或者,如果进行了点选择,则删除下一个字符。 | IEditManager | ||
删除下一个字。 | IEditManager | ||
删除某一范围内的文本,或者,如果进行了点选择,则删除上一个字符。 | IEditManager | ||
删除上一个字。 | IEditManager | ||
删除某一范围内的文本。 | IEditManager | ||
执行 FlowOperation。 | IEditManager | ||
![]() |
处理 edit 事件。 | IInteractionEventHandler | |
结束一组操作。 | IEditManager | ||
![]() |
执行任何挂起的 FlowOperations。 | ISelectionManager | |
![]() |
处理 focusChange 事件。 | IInteractionEventHandler | |
![]() |
处理 focusIn 事件。 | IInteractionEventHandler | |
![]() |
处理 focusOut 事件。 | IInteractionEventHandler | |
![]() | getCommonCharacterFormat(range:flashx.textLayout.elements:TextRange = null):flashx.textLayout.formats:TextLayoutFormat
获取对于指定的文本范围或当前所选项目中的所有字符都通用的字符格式属性。 | ISelectionManager | |
![]() | getCommonContainerFormat(range:flashx.textLayout.elements:TextRange = null):flashx.textLayout.formats:TextLayoutFormat
获取对于指定的文本范围或当前所选项目中的所有容器都通用的容器格式属性。 | ISelectionManager | |
![]() | getCommonParagraphFormat(range:flashx.textLayout.elements:TextRange = null):flashx.textLayout.formats:TextLayoutFormat
获取对于指定的文本范围或当前选区中的所有段落都通用的段落格式属性。 | ISelectionManager | |
![]() |
获取当前所选内容的 SelectionState 对象。 | ISelectionManager | |
![]() |
指示是否进行了选择。 | ISelectionManager | |
![]() |
处理 imeStartComposition 事件。
| IInteractionEventHandler | |
insertInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):InlineGraphicElement
插入图像。 | IEditManager | ||
插入文本。 | IEditManager | ||
![]() |
指示选择时是否涵盖某一文本范围。 | ISelectionManager | |
![]() |
处理 keyDown 事件。 | IInteractionEventHandler | |
![]() |
处理 keyFocusChange 事件。 | IInteractionEventHandler | |
![]() |
处理 keyUp 事件。 | IInteractionEventHandler | |
![]() |
处理 menuSelect 事件。 | IInteractionEventHandler | |
modifyInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):void
修改现有内嵌图形。 | IEditManager | ||
![]() |
处理 mouseDoubleClick 事件。 | IInteractionEventHandler | |
![]() |
处理 mouseDown 事件。 | IInteractionEventHandler | |
![]() |
处理 mouseMove 事件。 | IInteractionEventHandler | |
![]() |
处理 mouseOut 事件。 | IInteractionEventHandler | |
![]() |
处理 mouseOver 事件。 | IInteractionEventHandler | |
![]() |
处理 mouseUp 事件。 | IInteractionEventHandler | |
![]() |
处理 mouseWheel 事件。 | IInteractionEventHandler | |
moveChildren(source:FlowGroupElement, sourceIndex:int, numChildren:int, destination:FlowGroupElement, destinationIndex:int, operationState:SelectionState = null):void 将一组 FlowElement 从一个 FlowGroupElement 移动至另一个 FlowGroupElement。 | IEditManager | ||
![]() |
插入或删除文本时更新选择管理器。 | ISelectionManager | |
覆盖所选文本。 | IEditManager | ||
pasteTextScrap(scrapToPaste:flashx.textLayout.edit:TextScrap, operationState:SelectionState = null):void
将 TextScrap 粘贴到选定区域。 | IEditManager | ||
执行上一个撤消的操作。 | IEditManager | ||
![]() |
重新显示选择形状。 | ISelectionManager | |
![]() |
选择整个流。 | ISelectionManager | |
![]() |
选择某一范围的文本。 | ISelectionManager | |
![]() |
将焦点设置到所选内容中的第一个容器。 | ISelectionManager | |
![]() |
设置当前选定内容的 SelectionState 对象。 | ISelectionManager | |
![]() |
处理 softKeyboardActivating 事件
| IInteractionEventHandler | |
在指定位置拆分目标元素,同时在当前元素后创建新元素。 | IEditManager | ||
在当前位置拆分段落,同时在当前段落后创建新段落。 | IEditManager | ||
![]() |
处理 TextEvent。 | IInteractionEventHandler | |
恢复上一个操作。 | IEditManager | ||
在操作对其进行修改后显示。 | IEditManager | ||
allowDelayedOperations | 属性 |
allowDelayedOperations:Boolean| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10.2, AIR 2.0 |
控制操作是否可以排队等候随后执行。
某些操作的执行可能会由于性能优化而延迟。例如,能够方便地将多个键击合并为单个插入操作。如果 allowDelayedOperations 为 true,则操作可能需要排队。如果为 false,将立即执行所有操作。默认情况下,此值为 true。
实现
public function get allowDelayedOperations():Boolean public function set allowDelayedOperations(value:Boolean):void相关 API 元素
delayUpdates | 属性 |
delayUpdates:Boolean| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10.2, AIR 2.0 |
默认情况下,调用 IEditManager 会同步处理更新,所以会生成请求的更改,文本会重新合成并添加至 IEditManager 方法的显示列表中。若要获得延迟的重新绘制,请将 delayUpdates 设置为 true。这会引起 IEditManager 仅更新模型,然后在下一个 enter_frame 事件中重新合成并重新绘制。
实现
public function get delayUpdates():Boolean public function set delayUpdates(value:Boolean):voidundoManager | 属性 |
undoManager:IUndoManager [只读] | 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
指定给该 EditManager 实例的 UndoManager 对象(如果有)。
撤消管理器可处理撤消和重做操作。
实现
public function get undoManager():IUndoManagerapplyContainerFormat | () | 方法 |
public function applyContainerFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将容器样式应用于所选项目中的任何容器。
格式对象中所有 null 样式属性将不会改变。
参数
format:flashx.textLayout.formats:ITextLayoutFormat — 要应用于范围内容器的格式
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
public class EditManager_applyContainerFormat
{
public function EditManager_applyContainerFormat( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var containerStyle:TextLayoutFormat = new TextLayoutFormat();
containerStyle.columnCount = 2;
editManager.applyContainerFormat( containerStyle );
}
}
}
applyFormat | () | 方法 |
public function applyFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
更改指定(或当前)选择部分的格式。
执行一个不可撤消的操作,该操作将应用新格式。只应用为 TextLayoutFormat 对象设置的样式属性。格式对象中的未定义属性没有改变。
参数
leafFormat:flashx.textLayout.formats:ITextLayoutFormat — 要应用于叶元素(例如跨距和内嵌图形)的格式。
| |
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat — 要应用于段落元素的格式。
| |
containerFormat:flashx.textLayout.formats:ITextLayoutFormat — 要应用于容器的格式。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextAlign;
import flashx.textLayout.formats.TextLayoutFormat;
public class EditManager_applyFormat
{
public function EditManager_applyFormat( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var containerStyle:TextLayoutFormat = new TextLayoutFormat();
containerStyle.columnCount = 2;
var paraStyle:TextLayoutFormat = new TextLayoutFormat();
paraStyle.textAlign = TextAlign.JUSTIFY;
var charStyle:TextLayoutFormat = new TextLayoutFormat();
charStyle.color = 0xff0000;
editManager.applyFormat( charStyle, paraStyle, containerStyle );
}
}
}
applyFormatToElement | () | 方法 |
public function applyFormatToElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将样式应用于指定元素。
格式对象中所有 null 样式属性将不会改变。只有与指定元素相关的样式才会被应用。
参数
targetElement:FlowElement — 将应用样式的元素。
| |
format:flashx.textLayout.formats:ITextLayoutFormat — 包含要应用的样式的格式。
| |
relativeStart:int (default = 0) — 分配新格式时,距离拆分元素时所在的元素开头的偏移。
| |
relativeEnd:int (default = -1) — 应用新格式时,距离拆分元素时所在的元素开头的偏移。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.FlowElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
public class EditManager_applyFormatToElement
{
public function EditManager_applyFormatToElement( selection:SelectionState ):void
{
var textFlow:TextFlow = TextConverter.importToFlow("<TextFlow><div><p><span>Hello World</span></p></div><p>No indent</p></TextFlow>", TextConverter.TEXT_LAYOUT_FORMAT);
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var divElement:FlowElement = textFlow.getChildAt(0);
var format:TextLayoutFormat = new TextLayoutFormat();
format.textIndent = 15;
editManager.applyFormatToElement( divElement, format );
}
}
}
applyLeafFormat | () | 方法 |
public function applyLeafFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
更改应用于指定(或当前)选择部分中叶元素的格式。
执行一个不可撤消的操作,该操作将新格式应用于叶元素,例如 SpanElement 和 InlineGraphicElement 对象。只应用为 TextLayoutFormat 对象设置的样式属性。格式对象中的未定义属性已改变。
参数
format:flashx.textLayout.formats:ITextLayoutFormat — 要应用的格式。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
public class EditManager_applyLeafFormat
{
public function EditManager_applyLeafFormat(selection:SelectionState)
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var charStyle:TextLayoutFormat = new TextLayoutFormat();
charStyle.color = 0xff0000;
editManager.applyLeafFormat( charStyle );
}
}
}
applyLink | () | 方法 |
public function applyLink(href:String, target:String = null, extendToLinkBoundary:Boolean = false, operationState:SelectionState = null):LinkElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将选择部分转换为一个链接,或将链接转换为普通文本。
执行一个创建或删除链接的不可撤消的操作。
如果指定了 target 参数,则必须为下列值之一:
- "_self"
- "_blank"
- "_parent"
- "_top"
在浏览器承载的运行时中,目标为 "_self" 时将替换当前的 html 页。因此,如果包含链接的 SWF 内容位于某页中的一个框架或框架集内,则链接的内容将加载在该框架内。如果页面位于顶层,则链接的内容打开时会替换原始页。目标为 "_blank" 时将打开一个新的浏览器窗口(未命名)。目标为 "_parent" 时将替换包含 SWF 内容的 html 页的父代。目标为 "_top" 时将替换当前浏览器窗口中的顶层页。
在其它运行时中,例如 Adobe AIR 中,链接在用户的默认浏览器中打开,并忽略 target 参数。
extendToLinkBoundary 参数确定编辑管理器如何处理与一个或多个现有链接相交的选择部分。如果该参数为 true,则该操作作为一个单元应同时应用于选择部分及现有链接的全部文本。因此,将会创建单个链接,范围从相交的第一个链接开头开始,到相交的最后一个链接末尾为止。与此相反,如果在此情况下 extendToLinkBoundary 为 false,则当前部分选择的链接将会拆分为两个链接。
参数
href:String — 链接引用的 URI。
| |
target:String (default = null) — 链接的目标浏览器窗口。
| |
extendToLinkBoundary:Boolean (default = false) — 指定是否使用任何现有链接进行重叠来巩固选择,然后应用更改。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
LinkElement — 已创建的 LinkElement。
|
相关 API 元素
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
public class EditManager_applyLink
{
static public function makeLink( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
editManager.applyLink( "http://www.adobe.com" );
}
static public function removeLink( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
editManager.applyLink( null, null, true );
}
}
}
applyParagraphFormat | () | 方法 |
public function applyParagraphFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将段落样式应用于所选项目中的任何段落。
格式对象中所有 null 样式属性将不会改变。
参数
format:flashx.textLayout.formats:ITextLayoutFormat — 要应用于所选段落的格式。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextAlign;
import flashx.textLayout.formats.TextLayoutFormat;
public class EditManager_applyParagraphFormat
{
static public function justifyParagraph( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var paraStyle:TextLayoutFormat = new TextLayoutFormat();
paraStyle.textAlign = TextAlign.JUSTIFY;
editManager.applyParagraphFormat( paraStyle );
}
}
}
applyTCY | () | 方法 |
public function applyTCY(tcyOn:Boolean, operationState:SelectionState = null):flashx.textLayout.elements:TCYElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将文本转换为 TCY 串或将 TCY 串转换为非 TCY 文本。
日语文本中的 TCY(表示 tate-chuu-yoko)可使文本在一个垂直行内水平绘制,并用于提高非日文文本或数字(例如日期)的小文本块在垂直文本中的可读性。
参数
tcyOn:Boolean — 设置为 true 时会将 TCY 应用于文本范围,指定为 false 时会删除 TCY。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
flashx.textLayout.elements:TCYElement — 已创建的 TCYElement。
|
相关 API 元素
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
public class EditManager_applyTCY
{
static public function tcyOn( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
editManager.applyTCY( true );
}
static public function tcyOff( selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
editManager.applyTCY( false );
}
}
}
beginCompositeOperation | () | 方法 |
public function beginCompositeOperation():void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
开始一组新操作。
在调用 beginCompositeOperation() 之后及调用对应的 endCompositeOperation() 之前执行的所有操作,将作为单个操作执行和成组,该操作可作为一个单元撤消。
beginCompositeOperation/endCompositeOperation 块可以嵌入在其它 beginCompositeOperation/endCompositeOperation 块中。
相关 API 元素
示例 ( 如何使用本示例 )
beginCompositeOperation() 和 endCompositeOperation() 函数,则其中每个子操作将必须单独撤消而不是作为一个组撤消。
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
public class EditManager_beginCompositeOperation
{
static public function insertGraphic( source:Object, width:Object, height:Object, float:String, selection:SelectionState ):void
{
var editManager:IEditManager = selection.textFlow.interactionManager as IEditManager;
editManager.beginCompositeOperation();
editManager.deleteText( selection );
var changedSelection:SelectionState =
new SelectionState( selection.textFlow, selection.anchorPosition, selection.anchorPosition );
editManager.splitParagraph( changedSelection );
changedSelection =
new SelectionState( changedSelection.textFlow, changedSelection.anchorPosition + 1, changedSelection.anchorPosition + 1);
editManager.insertInlineGraphic( source, width, height, float, changedSelection );
changedSelection =
new SelectionState( changedSelection.textFlow, changedSelection.anchorPosition + 1, changedSelection.anchorPosition + 1);
editManager.splitParagraph( changedSelection );
editManager.endCompositeOperation();
}
}
}
changeElementID | () | 方法 |
public function changeElementID(newID:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
更改元素的 ID。
如果将 relativeStart 或 relativeEnd 参数设置为非默认值,则会拆分元素。位于该范围之外的元素部分将保留原始 ID。设置 relativeStart 和 relativeEnd 参数将使用重复的 ID 创建元素。
参数
newID:String — 新 ID 值。
| |
targetElement:FlowElement — 要修改的元素。
| |
relativeStart:int (default = 0) — 指定新 ID 时,距离拆分元素时所在的元素开头的偏移。
| |
relativeEnd:int (default = -1) — 指定新 ID 时,距离拆分元素时所在的元素开头的偏移。
| |
operationState:SelectionState (default = null) — 指定撤消此操作时要还原的当前选择;如果为 null,则该操作会保存当前选择。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.ElementRange;
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
public class EditManager_changeElementID
{
static public function changeParagraphID( id:String, selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var selectedRange:ElementRange = ElementRange.createElementRange( selection.textFlow, selection.absoluteStart, selection.absoluteEnd );
editManager.changeElementID( id, selectedRange.firstParagraph, 0, -1, selection );
}
}
}
changeStyleName | () | 方法 |
public function changeStyleName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
更改整个元素或部分元素的 styleName。
如果将 relativeStart 或 relativeEnd 参数设置为非默认值,则会拆分元素。位于该范围之外的元素部分将保留原始样式。
参数
newName:String — 新样式的名称。
| |
targetElement:FlowElement — 指定要更改的元素。
| |
relativeStart:int (default = 0) — 指定新样式时,距离拆分元素时所在的元素开头的偏移。
| |
relativeEnd:int (default = -1) — 指定新样式时,距离拆分元素时所在的元素末尾的偏移。
| |
operationState:SelectionState (default = null) — 指定撤消此操作时要还原的当前选择;如果为 null,则该操作会保存当前选择。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.ElementRange;
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
public class EditManager_changeStyleName
{
static public function changeParagraphStyle( styleName:String, selection:SelectionState ):void
{
var textFlow:TextFlow = selection.textFlow;
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
var selectedRange:ElementRange = ElementRange.createElementRange( selection.textFlow, selection.absoluteStart, selection.absoluteEnd );
editManager.changeElementID( styleName, selectedRange.firstParagraph, 0, -1, selection );
}
}
}
changeTypeName | () | 方法 |
public function changeTypeName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
更改整个元素或部分元素的 typeName。
如果将 relativeStart 或 relativeEnd 参数设置为非默认值,则会拆分元素。位于该范围之外的元素部分将保留原始样式。
参数
newName:String — 新类型的名称。
| |
targetElement:FlowElement — 指定要更改的元素。
| |
relativeStart:int (default = 0) — 指定新样式时,距离拆分元素时所在的元素开头的偏移
| |
relativeEnd:int (default = -1) — 指定新样式时,距离拆分元素时所在的元素末尾的偏移
| |
operationState:SelectionState (default = null) — 指定撤消此操作时要还原的当前选择;如果为 null,则该操作会保存当前选择。
|
clearFormat | () | 方法 |
public function clearFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
对指定(或当前)所选项目的格式取消定义。
执行一个不可撤消的操作,该操作对指定格式取消定义。只应用为 TextLayoutFormat 对象设置的样式属性。格式对象中的未定义属性没有改变。
参数
leafFormat:flashx.textLayout.formats:ITextLayoutFormat — 一种格式,其设置值指示用于取消定义选定范围中 LeafFlowElement 对象的属性。
| |
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat — 其设置的值指示对所选范围内的 ParagraphElement 对象取消定义的属性的格式。
| |
containerFormat:flashx.textLayout.formats:ITextLayoutFormat — 其设置的值指示对所选范围内的 ContainerController 对象取消定义的属性的格式。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
clearFormatOnElement | () | 方法 |
public function clearFormatOnElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
对指定元素的样式取消定义。
格式对象中所有 undefined 的样式属性将保持不变。在指定的格式中定义的任何样式都未在指定的元素上定义。
参数
targetElement:FlowElement — 将应用样式的元素。
| |
format:flashx.textLayout.formats:ITextLayoutFormat — 包含要取消定义的样式的格式。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
createDiv | () | 方法 |
public function createDiv(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):DivElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
在同时包含范围的开始和结束点的最低公共父元素位置,创建包含在 operationState 中指定的整个范围的新 DivElement。如果开始和结束点是相同的,则会在此位置使用单个子段落创建新的 DivElement。
参数
parent:FlowGroupElement (default = null) — 为新的 DivElement 指定父代元素。如果为 null,则新的父代是包含 SelectionState 的最低级别。
| |
format:flashx.textLayout.formats:ITextLayoutFormat (default = null) — 应用于新 DivElement 的格式属性。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
DivElement — 已创建的新 DivElement.
|
createList | () | 方法 |
public function createList(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):ListElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
在同时包含范围的开始和结束点的最低公共父元素位置,创建包含在 operationState 中指定的整个范围的新 ListElement。范围中的每个段落会成为新 ListElement 中的 ListItemElement。如果开始和结束点是相同的,则会在此位置使用单个 ListItemElement 子代创建新 ListElement。
参数
parent:FlowGroupElement (default = null) — 为新的 ListElement 指定父代元素(可选)。如果为 null,则新的父代是包含 SelectionState 的最低级别。
| |
format:flashx.textLayout.formats:ITextLayoutFormat (default = null) — 应用于新 ListElement 的格式属性。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
ListElement — 已创建的新 ListElement.
|
createSubParagraphGroup | () | 方法 |
public function createSubParagraphGroup(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):SubParagraphGroupElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
在同时包含范围的开始和结束点的最低公共父元素位置,创建包含在 operationState 中指定的整个范围的新 SubParagraphGroupElement。如果开始和结束点相同,则无操作。
参数
parent:FlowGroupElement (default = null) — 为新的 SubParagraphGroupElement 元素指定父代元素。如果为 null,则新的父代是包含 SelectionState 的最低级别。
| |
format:flashx.textLayout.formats:ITextLayoutFormat (default = null) — 应用于新 SubParagraphGroupElement 的格式属性
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
SubParagraphGroupElement — 已创建的新 SubParagraphGroupElement.
|
cutTextScrap | () | 方法 |
public function cutTextScrap(operationState:SelectionState = null):flashx.textLayout.edit:TextScrap| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
删除选择的区域并在 TextScrap 对象中返回删除的区域。
生成的 TextScrap 可以发布到系统剪贴板或用于后续的 pasteTextOperation() 操作中。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
flashx.textLayout.edit:TextScrap — 剪切的 TextScrap。
|
相关 API 元素
flashx.textLayout.edit.TextClipboard.setContents
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.TextScrap;
import flashx.undo.UndoManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_cutTextScrap
{
static public function cutTextScrap():TextScrap
{
var textFlow:TextFlow = TextConverter.importToFlow( "How do now brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( new Sprite() ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 4, 7 );
var scrap:TextScrap = editManager.cutTextScrap(); //Displays: How now brown cow.
return scrap;
}
}
}
deleteNextCharacter | () | 方法 |
public function deleteNextCharacter(operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
删除某一范围内的文本,或者,如果进行了点选择,则删除下一个字符。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_deleteNextCharacter
{
static public function deleteNextCharacter():void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How now brown crow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( new Sprite() ));
var editManager:EditManager = new EditManager();
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 15, 15 );
editManager.deleteNextCharacter(); //displays: How now brown cow.
}
}
}
deleteNextWord | () | 方法 |
public function deleteNextWord(operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
删除下一个字。
如果选择了一个范围,则会删除该范围内的第一个字。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_deleteNextWord
{
static public function deleteNextWord():void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How do now brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( new Sprite() ));
var editManager:EditManager = new EditManager();
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 3, 3 );
editManager.deleteNextWord(); //displays: How now brown cow.
}
}
}
deletePreviousCharacter | () | 方法 |
public function deletePreviousCharacter(operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
删除某一范围内的文本,或者,如果进行了点选择,则删除上一个字符。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_deletePreviousCharacter
{
static public function deletePreviousCharacter():void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How now brown crow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( new Sprite() ));
var editManager:EditManager = new EditManager();
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 16, 16 );
editManager.deletePreviousCharacter(); //displays: How now brown cow.
}
}
}
deletePreviousWord | () | 方法 |
public function deletePreviousWord(operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
删除上一个字。
如果选择了一个范围,则会删除该范围内的第一个字。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
var textFlow:TextFlow = TextConverter.importToFlow( "How do now brown cow.", TextConverter.PLAIN_TEXT_FORMAT ); textFlow.flowComposer = new StandardFlowComposer(); textFlow.flowComposer.addController( new ContainerController( this )); var editManager:EditManager = new EditManager( new UndoManager() ); textFlow.interactionManager = editManager; textFlow.flowComposer.updateAllControllers(); editManager.setSelection( 7, 7 ); editManager.deletePreviousWord(); //displays: How now brown cow.
deleteText | () | 方法 |
public function deleteText(operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
删除某一范围内的文本。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_deleteText
{
static public function deleteText():void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How do now brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( new Sprite() ));
var editManager:EditManager = new EditManager();
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 4, 7 );
editManager.deleteText(); //displays: How now brown cow.
}
}
}
doOperation | () | 方法 |
public function doOperation(operation:FlowOperation):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
执行 FlowOperation。
doOperation() 方法由更新文本流的 IEditManager 函数调用。您通常不需要直接调用该函数,除非要创建自定义操作。
该函数继续执行下列步骤:
- 在执行该操作之前刷新任何挂起的操作。
- 发送可取消的 flowOperationBegin 事件。如果取消,则该方法立即返回。
- 执行该操作。该操作返回
true或false。False表明没有进行任何更改。 - 将操作推入到撤消堆栈中。
- 清除重做堆栈。
- 更新显示。
- 发送可取消的 flowOperationEnd 事件。
异常处理:如果该操作引发异常,则会被捕获,而错误将附加到 flowOperationEnd 事件。如果未取消该错误,将会重新引发错误。
参数
operation:FlowOperation — FlowOperation 对象
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.operations.InsertTextOperation;
public class EditManager_doOperation
{
static public function doOperation(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager();
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
var selectionState:SelectionState = new SelectionState(textFlow, 4, 4);
var insertOperation:InsertTextOperation = new InsertTextOperation( selectionState, "now " );
editManager.doOperation( insertOperation ); // displays: How now brown cow
}
}
}
endCompositeOperation | () | 方法 |
public function endCompositeOperation():void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
结束一组操作。
自上一个 beginCompositeOperation() 调用后执行的所有操作将组成为一个 CompositeOperation,然后完成该复合操作。该 CompositeOperation 对象会添加到撤消堆栈中,或者,如果该复合操作嵌入在其它复合操作中,则会添加到该父操作。
相关 API 元素
insertInlineGraphic | () | 方法 |
public function insertInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):InlineGraphicElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
插入图像。
图像的源可以是包含 URI 的字符串、URLRequest 对象、表示嵌入资源的 Class 对象或 DisplayObject 实例。
宽度和高度值可以是像素数、百分比或字符串“auto”,在此情况下将使用图形的实际尺寸。
将 float 设置为 Float 类中定义的一个常量,以指定图像应显示在任何文本的左侧或右侧还是嵌入在文本中。
参数
source:Object — 可以是解释为 URI 的 String、解释为 Embed DisplayObject 类的 Class、DisplayObject 实例或 URLRequest。
| |
width:Object — 要插入的图像的宽度(数字、百分比或“auto”)。
| |
height:Object — 要插入的图像的高度(数字、百分比或“auto”)。
| |
options:Object (default = null) — 全不支持.
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
InlineGraphicElement |
相关 API 元素
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Shape;
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
import flashx.undo.UndoManager;
public class EditManager_insertInlineGraphic
{
static public function insertInlineGraphic(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How now brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 0, 0 );
editManager.insertInlineGraphic( createGraphic(), 6, 6, "none" );
}
static private function createGraphic():Shape
{
var shape:Shape = new Shape();
shape.graphics.beginFill( 0x993366 );
shape.graphics.drawCircle( 5, 4, 6 );
return shape;
}
}
}
insertText | () | 方法 |
public function insertText(text:String, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
插入文本。
在文本中某一位置或范围内插入文本。如果 operationState 参数提供的位置是一个范围(或者该参数为 null 而当前选择内容是一个范围),则当前位于该范围内的文本将被插入的文本替换。
参数
text:String — 要插入的字符串。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的流中文本;如果为 null,则该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
import flashx.undo.UndoManager;
public class EditManager_insertText
{
static public function insertText(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 4, 4 );
editManager.insertText( "now " );
}
}
}
modifyInlineGraphic | () | 方法 |
public function modifyInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
修改现有内嵌图形。
将无变化的属性设置为原始图形中的值。(修改现有图形对象通常比删除并重新创建一个图形对象效率更高。)
参数
source:Object — 可以是解释为 URI 的 String、解释为 Embed DisplayObject 类的 Class、DisplayObject 实例或 URLRequest。
| |
width:Object — 图像的新宽度(数字或百分比)。
| |
height:Object — 图像的新高度(数字或百分比)。
| |
options:Object (default = null) — 全不支持.
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
相关 API 元素
示例 ( 如何使用本示例 )
width 和 height 属性以将其拉伸为一个椭圆:
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flash.display.Shape;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
import flashx.undo.UndoManager;
public class EditManager_modifyInlineGraphic
{
static public function modifyInlineGraphic(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How now brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 0, 0 );
editManager.insertInlineGraphic( createGraphic(), 6, 6, "none" );
editManager.selectRange( 0, 1 );
editManager.modifyInlineGraphic( null, '12', '5', 'none' );
}
static private function createGraphic():Shape
{
var shape:Shape = new Shape();
shape.graphics.beginFill( 0x993366 );
shape.graphics.drawCircle( 4, 4, 6 );
return shape;
}
}
}
moveChildren | () | 方法 |
public function moveChildren(source:FlowGroupElement, sourceIndex:int, numChildren:int, destination:FlowGroupElement, destinationIndex:int, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将一组 FlowElement 从一个 FlowGroupElement 移动至另一个 FlowGroupElement。目标属性必须是正在移动的子代的合法父代类型,否则会引发异常。
参数
source:FlowGroupElement — 要移动的元素的原始父代。
| |
sourceIndex:int — 要移动的第一个元素的源中的子索引。
| |
numChildren:int — 要移动的子元素数。
| |
destination:FlowGroupElement — 移动后元素的新父代。
| |
destinationIndex:int — 要将元素移动到的目标中的子索引。
| |
operationState:SelectionState (default = null) — 指定该操作所应用的文本,以及指定撤消时选择内容返回到的文本。如果为 null,则操作应用于当前选择内容。如果没有当前选区,则该参数必须为非 null。
|
overwriteText | () | 方法 |
public function overwriteText(text:String, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
覆盖所选文本。
如果进行了点选择,则新文本将覆盖第一个字符。
参数
text:String — 要插入的字符串。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.TextFlow;
import flashx.undo.UndoManager;
public class EditManager_overwriteText
{
static public function overwriteText(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How zzz brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 4, 6 );
editManager.overwriteText( "now" ); //Displays: How now brown cow.
}
}
}
pasteTextScrap | () | 方法 |
public function pasteTextScrap(scrapToPaste:flashx.textLayout.edit:TextScrap, operationState:SelectionState = null):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
将 TextScrap 粘贴到选定区域。
如果指定了文本范围,则会删除该范围内的文本。
参数
scrapToPaste:flashx.textLayout.edit:TextScrap — 要粘贴的 TextScrap。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
相关 API 元素
flashx.textLayout.edit.TextClipboard.getContents
flashx.textLayout.edit.TextScrap
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.TextScrap;
import flashx.textLayout.elements.TextFlow;
import flashx.undo.UndoManager;
public class EditManager_pasteTextScrap
{
static public function pasteText(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How brown cow now.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 13, 17 );
var scrap:TextScrap = editManager.cutTextScrap();
editManager.selectRange( 3, 3 );
editManager.pasteTextScrap( scrap ); //Displays: How now brown cow.
}
}
}
redo | () | 方法 |
public function redo():void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
执行上一个撤消的操作。
注意:如果与该 IEditManager 关联的 IUndoManager 也与其它 IEditManager 相关联,则有可能与后一个 IEditManager 关联的重做操作就是重做的操作。如果其它 IEditManager 的 FlowOperation 位于重做堆栈顶端,则可能发生这种情况。
如果未启用撤消功能,则该函数不执行任何操作。
相关 API 元素
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_redo
{
static public function redo( textFlow:TextFlow ):void
{
if( textFlow.interactionManager is IEditManager )
{
IEditManager( textFlow.interactionManager ).redo();
}
}
}
}
splitElement | () | 方法 |
public function splitElement(target:FlowGroupElement, operationState:SelectionState = null):FlowGroupElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
在指定位置拆分目标元素,同时在当前元素后创建新元素。如果 operationState 是一个范围,则会删除范围中的文本。在 operationState 指定的文本位置后创建新元素。请注意,拆分 SubParagraphGroupElement 将会无效果,因为它们会自动与相邻元素重新合并。
您可能要使用的示例就是,如果您有一个列表,并且希望将其分为两个列表。
参数
target:FlowGroupElement — 要拆分的元素。
| |
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
FlowGroupElement — 已创建的新段落。
|
splitParagraph | () | 方法 |
public function splitParagraph(operationState:SelectionState = null):ParagraphElement| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
在当前位置拆分段落,同时在当前段落后创建新段落。
如果指定了文本范围,则会删除该范围内的文本。
参数
operationState:SelectionState (default = null) — 指定该操作所作用的文本;如果为 null,该操作将应用于当前选择内容。
|
ParagraphElement — 已创建的新段落。
|
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.TextScrap;
import flashx.textLayout.elements.TextFlow;
import flashx.undo.UndoManager;
public class EditManager_splitParagraph
{
static public function splitParagraph(sprite:Sprite):void
{
var textFlow:TextFlow = TextConverter.importToFlow( "How now brown cow.", TextConverter.PLAIN_TEXT_FORMAT );
textFlow.flowComposer.addController( new ContainerController( sprite ));
var editManager:EditManager = new EditManager( new UndoManager() );
textFlow.interactionManager = editManager;
textFlow.flowComposer.updateAllControllers();
editManager.selectRange( 8, 8 );
editManager.splitParagraph(); //Displays: How now
// brown cow.
}
}
}
undo | () | 方法 |
public function undo():void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
恢复上一个操作。
注意:如果与该 IEditManager 关联的 IUndoManager 也与其它 IEditManager 相关联,则有可能与后一个 IEditManager 关联的撤消操作就是撤消的操作。如果其它 IEditManager 的 FlowOperation 位于撤消堆栈顶端,则可能会发生这种情况。
如果未启用撤消功能,则该函数不执行任何操作。
相关 API 元素
示例 ( 如何使用本示例 )
package flashx.textLayout.edit.examples
{
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.elements.TextFlow;
public class EditManager_undo
{
static public function undo( textFlow:TextFlow ):void
{
if( textFlow.interactionManager is IEditManager )
{
IEditManager( textFlow.interactionManager ).undo();
}
}
}
}
updateAllControllers | () | 方法 |
public function updateAllControllers():void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | Flash Player 10.2, AIR 2.0 |
在操作对其进行修改后显示。通常是自动处理,但 delayUpdates 打开时会调用此方法,且在下一个 enter_frame 事件前必须更新显示。
Tue Jun 12 2018, 11:04 AM Z
隐藏继承的公共属性
显示继承的公共属性