The selection manager keeps track of the selected text range, manages its formatting,
and can handle events affecting the selection. To allow a user to make selections in
a text flow, assign a SelectionManager object to the
The following table describes how the SelectionManager class handles keyboard shortcuts:
Key:
Assign a SelectionManager object to the
A selection manager manages a single text flow. A selection manager can also be
assigned to a text flow by setting the
A TextScrap is a holding place for all or part of a TextFlow. A range of text can be copied from a TextFlow into a TextScrap, and pasted from the TextScrap into another TextFlow.
Use the
The beginning elements
(such as
Format attributes that do not have the same value for all characters in the element range are set to
Format attributes that do not have the same value for all containers in the element range are set to
Format attributes that do not have the same value for all paragraphs in the element range are set to
If the range spans more than one FlowElement object, which means that more than one character format may exist within the range, the format of the first FlowElement object is returned.
If the range spans more than one container, the format of the first container is returned.
If the range spans more than one paragraph, the format of the first paragraph is returned.
A selection range has an anchor point, representing the point at which the selection of text began, and an active point, representing the point to which the selection is extended. The active point can be before or after the anchor point in the text. If a selection is modified (for example, by a user shift-clicking with the mouse), the active point changes while the anchor point always remains in the same position.
Note: Do not construct a SelectionState object in order to create a selection. To
create a selection in a text flow, call the
The
Note: The
To enable text flow editing, assign an IEditManager instance to the
Any style properties in the format object that are
Any style properties in the format object that are
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.
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.
Executes an undoable operation that creates or removes the link.
If a
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
The
Any style properties in the format object that are
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.
All operations executed after the call to
A
If the
If the
If the
Any style properties in the format object that are
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.
The resulting TextScrap can be posted to the system clipboard or used in a
subsequent
If a range is selected, the first word of the range is deleted.
If a range is selected, the first word of the range is deleted.
The
This function proceeds in the following steps:
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.
All operations executed since the last call to
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
Inserts the text at a position or range in the text. If the location supplied in the
Set unchanging properties to the values in the original graphic. (Modifying an existing graphic object is typically more efficient than deleting and recreating one.)
If the selection is a point selection, the first character is overwritten by the new text.
If a range of text is specified, the text in the range is deleted.
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.
An example where you might want to use this is if you have a list, and you want to divide it into two lists.
If a range of text is specified, the text in the range is deleted.
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.
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
An undo manager handles undo and redo operations.
A SelectionManager keeps track of the selected text range and handles events for a TextFlow.
A selection can be either a point selection or a range selection. A point selection is the insertion point and is indicated visually by drawing a cursor. A range selection includes the text between an anchor point and an active point.
The execution of some editing operations, such as text insertion, is delayed
until the next enterFrame event. Calling
Format attributes that do not have the same value for all characters in the specified element range or selection are set to
Format attributes that do not have the same value for all containers in the specified element range or selection are set to
Format attributes that do not have the same value for all paragraphs in the specified element range or selection are set to
Returns
Returns
Operations must call
Note: You do not need to call this method directly. It is called automatically.
If a negative number is passed as either of the parameters, then any existing selection is removed.
The absolute end is the same as either the active or the anchor point of the selection, whichever comes last in the text flow.
The absolute start is the same as either the active or the anchor point of the selection, whichever comes first in the text flow.
The active point is the volatile end of the selection. The active point is changed when the selection is modified. The active point can be at either the beginning or the end of the selection.
An anchor point is the stable end of the selection. When the selection is extended, the anchor point does not change. The anchor point can be at either the beginning or the end of the selection.
The current SelectionFormat object is chosen from the SelectionFormat objects assigned to the
The editing mode indicates whether the text flow supports selection, editing, or only reading. A text flow is made selectable by assigning a selection manager and editable by assigning an edit manager. Constants representing the editing modes are defined in the EditingMode class.
The
A selection manager manages a single text flow. A selection manager can also be
assigned to a text flow by setting the
The
To enable text flow editing, assign an EditManager object to the
The EditManager class supports the following keyboard shortcuts:
Note: The following keys do not work on Windows: alt-backspace, alt-delete, ctrl+alt-backspace, and ctrl+alt-delete. These keys do not generate an event for the runtime.
Assign an EditManager object to the
To enable support for undoing and redoing changes, pass an
IUndoManager instance to the EditManager constructor. You can use
the
If
To allow edits to be undone (and redone), pass an IUndoManager instance to the EditManager constructor. The undo manager maintains a stack of operations that have been executed, and it can undo or redo individual operations.
Note: If the TextFlow is modified directly (not via calls to the EditManager, but directly via calls to the managed FlowElement objects), then the EditManager clears the undo stack to prevent the stack from getting out of sync with the current state.
Edit events are dispatched for cut, copy, paste, and selectAll commands.
A SelectionFormat created with the default values will use black for the highlight colors, 1.0 for the alphas, and BlendMode.DIFFERENCE for the blending modes. The cursor blink rate is 500 milliseconds.
Setting the
Non-zero blink rate is only used when an EditManager is attached to the TextFlow.
Setting the
Setting the
When you copy a TextScrap to the TextClipboard, the information is copied to the system clipboard in two clipboard formats. One format is an XML string expressing the copied TextScrap object in Text Layout Markup syntax. This clipboard object uses the format name: "TEXT_LAYOUT_MARKUP". The second format is a plain-text string, which uses the standard Clipboard.TEXT_FORMAT name.
The methods of the TextClipboard class are static functions, you do not need to create an instance of TextClipboard.
If the "TEXT_LAYOUT_MARKUP" format is available, this method converts the formatted
string into a TextScrap and returns it. Otherwise, if the Clipboard.TEXT_Format is available,
this method converts the plain-text string into a TextScrap. If neither clipboard format
is available, this method returns
Flash Player requires that the
The TextScrap is placed onto the system clipboard as both a Text Layout Markup representation and a plain text representation.
Flash Player requires a user event (such as a key press or mouse click) before
calling
Neither selection nor editing is allowed.