Package | flashx.textLayout.edit |
Interface | public interface IEditManager extends ISelectionManager , IInteractionEventHandler |
Implementors | EditManager |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
To enable text flow editing, assign an IEditManager instance to the interactionManager
property of the TextFlow object. The edit manager handles changes to the text (such as insertions,
deletions, and format changes). Changes are reversible if the edit manager has an undo manager. The edit
manager triggers the recomposition and display of the text flow, as necessary.
Related API Elements
Property | Defined By | ||
---|---|---|---|
absoluteEnd : int [read-only]
The text position of the end of the selection, as an offset from the start of the text flow. | ISelectionManager | ||
absoluteStart : int [read-only]
The text position of the start of the selection, as an offset from the start of the text flow. | ISelectionManager | ||
activePosition : int [read-only]
The active point of the selection. | ISelectionManager | ||
allowDelayedOperations : Boolean Controls whether operations can be queued up for later execution. | IEditManager | ||
anchorPosition : int [read-only]
The anchor point of the selection. | ISelectionManager | ||
currentSelectionFormat : SelectionFormat [read-only]
The current SelectionFormat object. | ISelectionManager | ||
delayUpdates : Boolean
By default, calls into IEditManager handle updates synchronously, so the requested change is made and the text recomposed
and added to the display list within the IEditManager method. | IEditManager | ||
editingMode : String [read-only]
The editing mode. | ISelectionManager | ||
focused : Boolean [read-only]
Indicates whether a container in the text flow has the focus. | ISelectionManager | ||
focusedSelectionFormat : SelectionFormat
The SelectionFormat object used to draw the selection in a focused container. | ISelectionManager | ||
inactiveSelectionFormat : SelectionFormat
The SelectionFormat object used to draw the selection when it is not in the active window. | ISelectionManager | ||
textFlow : flashx.textLayout.elements:TextFlow
The TextFlow object managed by this selection manager. | ISelectionManager | ||
undoManager : IUndoManager [read-only]
The UndoManager object assigned to this EditManager instance, if there is one. | IEditManager | ||
unfocusedSelectionFormat : SelectionFormat
The SelectionFormat object used to draw the selection when it is not in a focused container, but is in
the active window. | ISelectionManager | ||
windowActive : Boolean [read-only]
Indicates whether the window associated with the text flow is active. | ISelectionManager |
Method | Defined By | ||
---|---|---|---|
Processes an activate event. | IInteractionEventHandler | ||
applyContainerFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Applies container styles to any containers in the selection. | IEditManager | ||
applyFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Changes the formats of the specified (or current) selection. | IEditManager | ||
applyFormatToElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Applies styles to the specified element. | IEditManager | ||
applyLeafFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Changes the format applied to the leaf elements in the
specified (or current) selection. | IEditManager | ||
applyLink(href:String, target:String = null, extendToLinkBoundary:Boolean = false, operationState:SelectionState = null):LinkElement
Transforms a selection into a link, or a link into normal text. | IEditManager | ||
applyParagraphFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Applies paragraph styles to any paragraphs in the selection. | IEditManager | ||
Transforms text into a TCY run, or a TCY run into non-TCY text. | IEditManager | ||
Begins a new group of operations. | IEditManager | ||
changeElementID(newID:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Changes the ID of an element. | IEditManager | ||
changeStyleName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void Deprecated since 2.0: Please Use applyFormatToElement
Changes the styleName of an element or part of an element. | IEditManager | ||
changeTypeName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Changes the typeName of an element or part of an element. | IEditManager | ||
clearFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Undefines formats of the specified (or current) selection. | IEditManager | ||
clearFormatOnElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Undefines styles to the specified element. | IEditManager | ||
createDiv(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):DivElement Creates a new DivElement that contains the entire range specified in the operationState at the lowest
common parent element that contains both the start and end points of the range. | IEditManager | ||
createList(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):ListElement Creates a new ListElement that contains the entire range specified in the operationState at the lowest
common parent element that contains both the start and end points of the range. | IEditManager | ||
createSubParagraphGroup(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):SubParagraphGroupElement Creates a new SubParagraphGroupElement that contains the entire range specified in the operationState at the lowest
common parent element that contains both the start and end points of the range. | IEditManager | ||
Deletes the selected area and returns the deleted area in a TextScrap object. | IEditManager | ||
Processes a deactivate event. | IInteractionEventHandler | ||
Deletes a range of text, or, if a point selection is given, deletes the next character. | IEditManager | ||
Deletes the next word. | IEditManager | ||
Deletes a range of text, or, if a point selection is given, deletes the previous character. | IEditManager | ||
Deletes the previous word. | IEditManager | ||
Deletes a range of text. | IEditManager | ||
Executes a FlowOperation. | IEditManager | ||
Processes an edit event. | IInteractionEventHandler | ||
Ends a group of operations. | IEditManager | ||
Executes any pending FlowOperations. | ISelectionManager | ||
Processes a focusChange event. | IInteractionEventHandler | ||
Processes a focusIn event. | IInteractionEventHandler | ||
Processes a focusOut event. | IInteractionEventHandler | ||
getCommonCharacterFormat(range:flashx.textLayout.elements:TextRange = null):flashx.textLayout.formats:TextLayoutFormat
Gets the character format attributes that are common to all characters in the specified text range or current selection. | ISelectionManager | ||
getCommonContainerFormat(range:flashx.textLayout.elements:TextRange = null):flashx.textLayout.formats:TextLayoutFormat
Gets the container format attributes that are common to all containers in the specified text range or current selection. | ISelectionManager | ||
getCommonParagraphFormat(range:flashx.textLayout.elements:TextRange = null):flashx.textLayout.formats:TextLayoutFormat
Gets the paragraph format attributes that are common to all paragraphs in the specified text range or current selection. | ISelectionManager | ||
Gets the SelectionState object of the current selection. | ISelectionManager | ||
Indicates whether there is a selection. | ISelectionManager | ||
Processes an imeStartComposition event
| IInteractionEventHandler | ||
insertInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):InlineGraphicElement
Inserts an image. | IEditManager | ||
Inserts text. | IEditManager | ||
Indicates whether the selection covers a range of text. | ISelectionManager | ||
Processes a keyDown event. | IInteractionEventHandler | ||
Processes a keyFocusChange event. | IInteractionEventHandler | ||
Processes a keyUp event. | IInteractionEventHandler | ||
Processes a menuSelect event. | IInteractionEventHandler | ||
modifyInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):void
Modifies an existing inline graphic. | IEditManager | ||
Processes a mouseDoubleClick event. | IInteractionEventHandler | ||
Processes a mouseDown event. | IInteractionEventHandler | ||
Processes a mouseMove event. | IInteractionEventHandler | ||
Processes a mouseOut event. | IInteractionEventHandler | ||
Processes a mouseOver event. | IInteractionEventHandler | ||
Processes a mouseUp event. | IInteractionEventHandler | ||
Processes a mouseWheel event. | IInteractionEventHandler | ||
moveChildren(source:FlowGroupElement, sourceIndex:int, numChildren:int, destination:FlowGroupElement, destinationIndex:int, operationState:SelectionState = null):void Move a set of FlowElements from one FlowGroupElement to another. | IEditManager | ||
Updates the selection manager when text is inserted or deleted. | ISelectionManager | ||
Overwrites the selected text. | IEditManager | ||
pasteTextScrap(scrapToPaste:flashx.textLayout.edit:TextScrap, operationState:SelectionState = null):void
Pastes the TextScrap into the selected area. | IEditManager | ||
Reperforms the previous undone operation. | IEditManager | ||
Redisplays the selection shapes. | ISelectionManager | ||
Selects the entire flow. | ISelectionManager | ||
Selects a range of text. | ISelectionManager | ||
Gives the focus to the first container in the selection. | ISelectionManager | ||
Sets the SelectionState object of the current selection. | ISelectionManager | ||
Processes an softKeyboardActivating event
| IInteractionEventHandler | ||
Splits the target element at the location specified, creating a new element after the current one. | IEditManager | ||
Splits the paragraph at the current position, creating a new paragraph after the current one. | IEditManager | ||
Processes a TextEvent. | IInteractionEventHandler | ||
Reverses the previous operation. | IEditManager | ||
Updates the display after an operation has modified it. | IEditManager |
allowDelayedOperations | property |
allowDelayedOperations:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10.2, AIR 2.0 |
Controls whether operations can be queued up for later execution.
Execution of some operations might be delayed as a performance optimization. For example, it is
convenient to be able to combine multiple keystrokes into a single insert operation. If
allowDelayedOperations
is true
, then operations may be queued up. If false
, all operations are
executed immediately. By default, it is true
.
Implementation
public function get allowDelayedOperations():Boolean
public function set allowDelayedOperations(value:Boolean):void
Related API Elements
delayUpdates | property |
delayUpdates:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10.2, AIR 2.0 |
By default, calls into IEditManager handle updates synchronously, so the requested change is made and the text recomposed
and added to the display list within the IEditManager method. To get a delayed redraw, set delayUpdates
to true
. This
causes the IEditManager to only update the model, and recompose and redraw on the next enter_frame
event.
Implementation
public function get delayUpdates():Boolean
public function set delayUpdates(value:Boolean):void
undoManager | property |
undoManager:IUndoManager
[read-only] Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The UndoManager object assigned to this EditManager instance, if there is one.
An undo manager handles undo and redo operations.
Implementation
public function get undoManager():IUndoManager
applyContainerFormat | () | method |
public function applyContainerFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Applies container styles to any containers in the selection.
Any style properties in the format object that are null
are left unchanged.
Parameters
format:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to the containers in the range
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function applyFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Changes the formats of the specified (or current) selection.
Executes an undoable operation that applies the new formats. Only style attributes set for the TextLayoutFormat objects are applied. Undefined attributes in the format objects are not changed.
Parameters
leafFormat:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to leaf elements such as spans and inline graphics.
| |
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to paragraph elements.
| |
containerFormat:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to the containers.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function applyFormatToElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Applies styles to the specified element.
Any style properties in the format object that are null
are left unchanged.
Only styles that are relevant to the specified element are applied.
Parameters
targetElement:FlowElement — The element to which the styles are applied.
| |
format:flashx.textLayout.formats:ITextLayoutFormat — The format containing the styles to apply.
| |
relativeStart:int (default = 0 ) — An offset from the beginning of the element at which to split the element when assigning the new formatting.
| |
relativeEnd:int (default = -1 ) — An offset from the beginning of the element at which to split the element when applying the new formatting.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function applyLeafFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Changes the format applied to the leaf elements in the specified (or current) selection.
Executes an undoable operation that applies the new format to leaf elements such as SpanElement and InlineGraphicElement objects. Only style attributes set for the TextLayoutFormat objects are applied. Undefined attributes in the format object are changed.
Parameters
format:flashx.textLayout.formats:ITextLayoutFormat — The format to apply.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function applyLink(href:String, target:String = null, extendToLinkBoundary:Boolean = false, operationState:SelectionState = null):LinkElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Transforms a selection into a link, or a link into normal text.
Executes an undoable operation that creates or removes the link.
If a target
parameter is specified, it must be one of the following values:
- "_self"
- "_blank"
- "_parent"
- "_top"
In browser-hosted runtimes, a target of "_self" replaces the current html page. So, if the SWF content containing the link is in a page within a frame or frameset, the linked content loads within that frame. If the page is at the top level, the linked content opens to replace the original page. A target of "_blank" opens a new browser window with no name. A target of "_parent" replaces the parent of the html page containing the SWF content. A target of "_top" replaces the top-level page in the current browser window.
In other runtimes, such as Adobe AIR, the link opens in the user's default browser and the
target
parameter is ignored.
The extendToLinkBoundary
parameter determines how the edit manager
treats a selection that intersects with one or more existing links. If the parameter is
true
, then the operation is applied as a unit to the selection and the
whole text of the existing links. Thus, a single link is created that spans from
the beginning of the first link intersected to the end of the last link intersected.
In contrast, if extendToLinkBoundary
were false
in this situation,
the existing partially selected links would be split into two links.
Parameters
href:String — The uri referenced by the link.
| |
target:String (default = null ) — The target browser window of the link.
| |
extendToLinkBoundary:Boolean (default = false ) — Specifies whether to consolidate selection with any overlapping existing links, and then apply the change.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
LinkElement — The LinkElement that was created.
|
Related API Elements
Example ( How to use this example )
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 | () | method |
public function applyParagraphFormat(format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Applies paragraph styles to any paragraphs in the selection.
Any style properties in the format object that are null
are left unchanged.
Parameters
format:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to the selected paragraphs.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function applyTCY(tcyOn:Boolean, operationState:SelectionState = null):flashx.textLayout.elements:TCYElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Transforms text into a TCY run, or a TCY run into non-TCY text.
TCY, or tate-chu-yoko, causes text to draw horizontally within a vertical line, and is used to make small blocks of non-Japanese text or numbers, such as dates, more readable in vertical text.
Parameters
tcyOn:Boolean — Set to true to apply TCY to a text range, false to remove TCY.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
flashx.textLayout.elements:TCYElement — The TCYElement that was created.
|
Related API Elements
Example ( How to use this example )
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 | () | method |
public function beginCompositeOperation():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Begins a new group of operations.
All operations executed after the call to beginCompositeOperation()
, and before the
matching call to endCompositeOperation()
are executed and grouped together as a single
operation that can be undone as a unit.
A beginCompositeOperation
/endCompositeOperation
block can be nested inside another
beginCompositeOperation
/endCompositeOperation
block.
Related API Elements
Example ( How to use this example )
beginCompositeOperation()
and endCompositeOperation()
functions were not used,
then each of the suboperations would have to be undone separately rather than as a group.
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 | () | method |
public function changeElementID(newID:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Changes the ID of an element.
If the relativeStart
or relativeEnd
parameters are set (to
anything other than the default values), then the element is split. The parts of the element
outside this range retain the original ID. Setting both the relativeStart
and
relativeEnd
parameters creates elements with duplicate IDs.
Parameters
newID:String — The new ID value.
| |
targetElement:FlowElement — The element to modify.
| |
relativeStart:int (default = 0 ) — An offset from the beginning of the element at which to split the element when assigning the new ID.
| |
relativeEnd:int (default = -1 ) — An offset from the beginning of the element at which to split the element when assigning the new ID.
| |
operationState:SelectionState (default = null ) — Specifies the selection to restore when undoing this operation;
if null , the operation saves the current selection.
|
Example ( How to use this example )
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 | () | method |
public function changeStyleName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Changes the styleName of an element or part of an element.
If the relativeStart
or relativeEnd
parameters are set (to
anything other than the default values), then the element is split. The parts of the element
outside this range retain the original style.
Parameters
newName:String — The name of the new style.
| |
targetElement:FlowElement — Specifies the element to change.
| |
relativeStart:int (default = 0 ) — An offset from the beginning of the element at which to split the element when assigning the new style.
| |
relativeEnd:int (default = -1 ) — An offset from the end of the element at which to split the element when assigning the new style.
| |
operationState:SelectionState (default = null ) — Specifies the selection to restore when undoing this operation;
if null , the operation saves the current selection.
|
Example ( How to use this example )
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 | () | method |
public function changeTypeName(newName:String, targetElement:FlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Changes the typeName of an element or part of an element.
If the relativeStart
or relativeEnd
parameters are set (to
anything other than the default values), then the element is split. The parts of the element
outside this range retain the original style.
Parameters
newName:String — The name of the new type.
| |
targetElement:FlowElement — Specifies the element to change.
| |
relativeStart:int (default = 0 ) — An offset from the beginning of the element at which to split the element when assigning the new style
| |
relativeEnd:int (default = -1 ) — An offset from the end of the element at which to split the element when assigning the new style
| |
operationState:SelectionState (default = null ) — Specifies the selection to restore when undoing this operation;
if null , the operation saves the current selection.
|
clearFormat | () | method |
public function clearFormat(leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Undefines formats of the specified (or current) selection.
Executes an undoable operation that undefines the specified formats. Only style attributes set for the TextLayoutFormat objects are applied. Undefined attributes in the format objects are not changed.
Parameters
leafFormat:flashx.textLayout.formats:ITextLayoutFormat — The format whose set values indicate properties to undefine to LeafFlowElement objects in the selected range.
| |
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat — The format whose set values indicate properties to undefine to ParagraphElement objects in the selected range.
| |
containerFormat:flashx.textLayout.formats:ITextLayoutFormat — The format whose set values indicate properties to undefine to ContainerController objects in the selected range.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
clearFormatOnElement | () | method |
public function clearFormatOnElement(targetElement:FlowElement, format:flashx.textLayout.formats:ITextLayoutFormat, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Undefines styles to the specified element.
Any style properties in the format object that are undefined
are left unchanged.
Any styles that are defined in the specififed format are undefined on the specified element.
Parameters
targetElement:FlowElement — The element to which the styles are applied.
| |
format:flashx.textLayout.formats:ITextLayoutFormat — The format containing the styles to undefine.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
createDiv | () | method |
public function createDiv(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):DivElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Creates a new DivElement that contains the entire range specified in the operationState at the lowest common parent element that contains both the start and end points of the range. If the start and end points are the same, a new DivElement is created at that position with a single child paragraph.
Parameters
parent:FlowGroupElement (default = null ) — Specifies a parent element for the new DivElement.
If null the new parent will be lowest level that contains the SelectionState.
| |
format:flashx.textLayout.formats:ITextLayoutFormat (default = null ) — Formatting attributes to apply to the new DivElement.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
DivElement — The new DivElement that was created.
|
createList | () | method |
public function createList(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):ListElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Creates a new ListElement that contains the entire range specified in the operationState at the lowest common parent element that contains both the start and end points of the range. Each paragraph within the range will become a ListItemElement in the new ListElement. If the start and end points are the same, a new ListElement is created at that position with a single ListItemElement child.
Parameters
parent:FlowGroupElement (default = null ) — Optionally specifies a parent element for the new ListElement.
If null the new parent will be lowest level that contains the SelectionState.
| |
format:flashx.textLayout.formats:ITextLayoutFormat (default = null ) — Formatting attributes to apply to the new ListElement.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
ListElement — The new ListElement that was created.
|
createSubParagraphGroup | () | method |
public function createSubParagraphGroup(parent:FlowGroupElement = null, format:flashx.textLayout.formats:ITextLayoutFormat = null, operationState:SelectionState = null):SubParagraphGroupElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Creates a new SubParagraphGroupElement that contains the entire range specified in the operationState at the lowest common parent element that contains both the start and end points of the range. If the start and end points are the same, nothing is done.
Parameters
parent:FlowGroupElement (default = null ) — Specifies a parent element for the new SubParagraphGroupElement element.
If null the new parent will be lowest level that contains the SelectionState.
| |
format:flashx.textLayout.formats:ITextLayoutFormat (default = null ) — Formatting attributes to apply to the new SubParagraphGroupElement
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
SubParagraphGroupElement — The new SubParagraphGroupElement that was created.
|
cutTextScrap | () | method |
public function cutTextScrap(operationState:SelectionState = null):flashx.textLayout.edit:TextScrap
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Deletes the selected area and returns the deleted area in a TextScrap object.
The resulting TextScrap can be posted to the system clipboard or used in a
subsequent pasteTextOperation()
operation.
Parameters
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
flashx.textLayout.edit:TextScrap — The TextScrap that was cut.
|
Related API Elements
flashx.textLayout.edit.TextClipboard.setContents
Example ( How to use this example )
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 | () | method |
public function deleteNextCharacter(operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Deletes a range of text, or, if a point selection is given, deletes the next character.
Parameters
operationState:SelectionState (default = null ) — specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function deleteNextWord(operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Deletes the next word.
If a range is selected, the first word of the range is deleted.
Parameters
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function deletePreviousCharacter(operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Deletes a range of text, or, if a point selection is given, deletes the previous character.
Parameters
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function deletePreviousWord(operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Deletes the previous word.
If a range is selected, the first word of the range is deleted.
Parameters
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function deleteText(operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Deletes a range of text.
Parameters
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function doOperation(operation:FlowOperation):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Executes a FlowOperation.
The doOperation()
method is called by IEditManager functions that
update the text flow. You do not typically need to call this function directly unless
you create your own custom operations.
This function proceeds in the following steps:
- Flush any pending operations before performing this operation.
- Send a cancelable flowOperationBegin event. If canceled this method returns immediately.
- Execute the operation. The operation returns
true
orfalse
.False
indicates that no changes were made. - Push the operation onto the undo stack.
- Clear the redo stack.
- Update the display.
- Send a cancelable flowOperationEnd event.
Exception handling: If the operation throws an exception, it is caught and the error is attached to the flowOperationEnd event. If the event is not canceled the error is rethrown.
Parameters
operation:FlowOperation — a FlowOperation object
|
Example ( How to use this example )
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 | () | method |
public function endCompositeOperation():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Ends a group of operations.
All operations executed since the last call to beginCompositeOperation()
are
grouped as a CompositeOperation that is then completed. This CompositeOperation object is added
to the undo stack or, if this composite operation is nested inside another composite operation,
added to the parent operation.
Related API Elements
insertInlineGraphic | () | method |
public function insertInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):InlineGraphicElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Inserts an image.
The source of the image can be a string containing a URI, URLRequest object, a Class object representing an embedded asset, or a DisplayObject instance.
The width and height values can be the number of pixels, a percent, or the string, 'auto', in which case the actual dimension of the graphic is used.
Set the float
to one of the constants defined in the Float class to specify whether
the image should be displayed to the left or right of any text or inline with the text.
Parameters
source:Object — Can be either a String interpreted as a uri, a Class interpreted as the class of an Embed DisplayObject,
a DisplayObject instance or a URLRequest.
| |
width:Object — The width of the image to insert (number, percent, or 'auto').
| |
height:Object — The height of the image to insert (number, percent, or 'auto').
| |
options:Object (default = null ) — None supported.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
InlineGraphicElement |
Related API Elements
Example ( How to use this example )
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 | () | method |
public function insertText(text:String, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Inserts text.
Inserts the text at a position or range in the text. If the location supplied in the
operationState
parameter is a range (or the parameter is null
and the
current selection is a range), then the text currently in the range
is replaced by the inserted text.
Parameters
text:String — The string to insert.
| |
operationState:SelectionState (default = null ) — Specifies the text in the flow to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function modifyInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Modifies an existing inline graphic.
Set unchanging properties to the values in the original graphic. (Modifying an existing graphic object is typically more efficient than deleting and recreating one.)
Parameters
source:Object — Can be either a String interpreted as a uri, a Class interpreted as the class of an Embed DisplayObject,
a DisplayObject instance or a URLRequest.
| |
width:Object — The new width for the image (number or percent).
| |
height:Object — The new height for the image (number or percent).
| |
options:Object (default = null ) — None supported.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Related API Elements
Example ( How to use this example )
width
and height
properties of the inline graphic to
stretch it into an ellipse:
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 | () | method |
public function moveChildren(source:FlowGroupElement, sourceIndex:int, numChildren:int, destination:FlowGroupElement, destinationIndex:int, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Move a set of FlowElements from one FlowGroupElement to another. The desinationElement must be a legal parent type for the children being moved, or an exception is thrown.
Parameters
source:FlowGroupElement — The orginal parent of the elements to be moved.
| |
sourceIndex:int — The child index within the source of the first element to be moved.
| |
numChildren:int — The number of children being moved.
| |
destination:FlowGroupElement — The new parent of elements after move.
| |
destinationIndex:int — The child index within the destination to where elements are moved to.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies, and to which selection returns to upon undo.
If null , the operation applies to the current selection. If there is no current selection, this parameter must be non-null.
|
overwriteText | () | method |
public function overwriteText(text:String, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Overwrites the selected text.
If the selection is a point selection, the first character is overwritten by the new text.
Parameters
text:String — The string to insert.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Example ( How to use this example )
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 | () | method |
public function pasteTextScrap(scrapToPaste:flashx.textLayout.edit:TextScrap, operationState:SelectionState = null):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Pastes the TextScrap into the selected area.
If a range of text is specified, the text in the range is deleted.
Parameters
scrapToPaste:flashx.textLayout.edit:TextScrap — The TextScrap to paste.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
Related API Elements
flashx.textLayout.edit.TextClipboard.getContents
flashx.textLayout.edit.TextScrap
Example ( How to use this example )
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 | () | method |
public function redo():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Reperforms the previous undone operation.
Note: If the IUndoManager associated with this IEditManager is also associated with another IEditManager, then it is possible that the redo operation associated with the other IEditManager is the one redone. This can happen if the FlowOperation of another IEditManager is on top of the redo stack.
This function does nothing if undo is not turned on.
Related API Elements
Example ( How to use this example )
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 | () | method |
public function splitElement(target:FlowGroupElement, operationState:SelectionState = null):FlowGroupElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Splits the target element at the location specified, creating a new element after the current one. If the operationState is a range, the text within the range is deleted. The new element is created after the text position specified by operationState. Note that splitting a SubParagraphGroupElement will have no effect because they will automatically remerge with the adejacent elements.
An example where you might want to use this is if you have a list, and you want to divide it into two lists.
Parameters
target:FlowGroupElement — The element to be split.
| |
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
FlowGroupElement — The new paragraph that was created.
|
splitParagraph | () | method |
public function splitParagraph(operationState:SelectionState = null):ParagraphElement
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Splits the paragraph at the current position, creating a new paragraph after the current one.
If a range of text is specified, the text in the range is deleted.
Parameters
operationState:SelectionState (default = null ) — Specifies the text to which this operation applies;
if null , the operation applies to the current selection.
|
ParagraphElement — The new paragraph that was created.
|
Example ( How to use this example )
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 | () | method |
public function undo():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Reverses the previous operation.
Note: If the IUndoManager associated with this IEditManager is also associated with another IEditManager, then it is possible that the undo operation associated with the other IEditManager is the one undone. This can happen if the FlowOperation of another IEditManager is on top of the undo stack.
This function does nothing if undo is not turned on.
Related API Elements
Example ( How to use this example )
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 | () | method |
public function updateAllControllers():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10.2, AIR 2.0 |
Updates the display after an operation has modified it. Normally this is handled automatically, but call
this method if delayUpdates
is on, and the display should be updated before the next enter_frame
event.
Wed Nov 21 2018, 06:34 AM -08:00