Each call to
To use a StandardFlowComposer, assign it to the
Note: For simple, static text flows, you can also use the one of the text line factory classes. These factory classes will typically create lines with less overhead than a flow composer, but do not support editing, dynamic changes, or user interaction.
To use an StandardFlowComposer object, assign it to the
The
If the contents of any container have changed, the method returns
A position can be considered to be the division between two characters or other elements of a text flow. If
the value in
The method returns -1 if the content at the specified position is not in any container or is outside the range of positions in the text flow.
A position is calculated by counting the division between two characters or other elements of a text flow. The position preceding the first element of a flow is zero. An absolute position is the position counting from the beginning of the flow.
This function is called automatically. Your code does not typically need to call this method. Classes that extend StandardFlowComposer can override this method to update event listeners and other properties that depend on the interaction manager.
The StandardFlowComposer calls the
Text layout is conducted in two phases: composition and display. In the composition phase,
the flow composer calculates how many lines are necessary to display the content as well as the position of these
lines in the flow's display containers. In the display phase,
the flow composer updates the display object children of its containers. The
This method updates all the text lines and the display list immediately and synchronously.
If the contents of any container is changed, the method returns
The
This method updates all the text lines and the display list immediately and synchronously.
If the contents of any container is changed, the method returns
FlowComposerBase is a utility class that implements methods and properties that are common to several types of flow composer. Application code would not typically instantiate or use this class (unless extending it to create a custom flow composer).
By default, the ISWFContext implementation is this FlowComposerBase object. Applications can provide a custom implementation to use fonts embedded in a different SWF file or to cache and reuse text lines.
Use this class to access information about how a line of text has been composed: its position,
height, width, and so on. When the text flow (TextFlow) is modified, the lines immediately before and at the
site of the modification are marked as invalid because they need to be recomposed. Lines after
the site of the modification might not be damaged immediately, but they might be regenerated once the
text is composed. You can access a TextFlowLine that has been damaged, but any values you access
reflect the old state of the TextFlow. When the TextFlow is recomposed, it generates new lines and you can
get the new line for a given position by calling
Note: No client should call this. It's exposed for writing your own composer.
If the line is the last line of a paragraph that has a space-after, the line will have
a
If the line is the first line of a paragraph that has a space-before applied, the line will have
a
A line can be invalid if the text, the attributes applied to it, or the controller settings have
changed since the line was created. An invalid line can still be displayed, and you can use it, but the values
used will be the values at the time it was created. The line returned by
Note: Although this property is technically
Note: Although this property is technically
Text flows displayed with a flow composer implementation can be dynamic and interactive. A flow composer manages one or more display controller. Each controller is associated with a display object container (such as a Sprite) through which the lines created for the text flow are ultimately displayed. The following diagram illustrates the relationship between TextFlow, IFlowComposer, ContainerController, and DisplayObjectContainer objects:
A flow composer calculates which portion of a text flow fits in each container and adds the appropriate text lines to the container's display object. The IFlowComposer interface defines separate methods for layout calculations and for updating the display. IFlowComposer also defines methods for incrementally composing and updating a text flow. These methods can be used to avoid blocking the user interface when updating long text flows.
In addition to managing text composition and display, a flow composer controls which container has focus, manages the display of the selection highlight (which can cross container boundaries), and provides direct access to all the TextLine objects in the flow.
To use an IFlowComposer implementation, assign an instance of that implementation to the
Note: For simple, static text flows, you can also use the one of the text line factory classes. These factory classes will typically create lines with less overhead than a flow composer, but do not support editing, dynamic changes, or user interaction.
The list of controllers is 0-based (the first controller has an index of 0).
The container is added to the end of the container list.
If the contents of any container up to and including the container at the specified
index has changed, the method returns
If the contents of any container up to and including the container holding the content at the specified
position has changed, the method returns
Implementations of this method should not update the display, but should save the results so that subsequent
calls to
If the contents of any container have changed, the method must return
A position can be considered to be the division between two characters or other elements of a text flow. If
the value in
The method must return -1 if the content at the specified position is not in any container or is outside the range of positions in the text flow.
A position can be considered to be the division between two characters or other elements of a text flow. If
the value in
The number of the first line is 0 and the number of the last line is equal to the number of lines minus one.
If the position specified in
A position can be considered to be the division between two characters or other elements of a text flow. If
the value in
The list of lines is numbered from zero to the number of lines minus one. If the value in
Implementations of IFlowComposer should update event listeners and properties that reference the interaction manager.
It is the responsibility of the implementation to define what setting the focus means. For example, an
implementation could use the built-in
Text layout is typically conducted in two phases: composition and display. In the composition phase,
the flow composer calculates how many lines are necesary to display the content as well as the position of these
lines in the flow's display containers. In the display phase,
the flow composer updates the display object children of its containers. The
This method updates all the text lines and the display list immediately and synchronously.
If the contents of any container is changed, the method must return
The
This method updates all the text lines and the display list immediately and synchronously.
If the contents of any container is changed, the method must return
Only a TextFlow object can be a root element.
Implementations of IFlowComposer should allow this property to be set so that users of the interface can create lines in a different SWF context than the one containing the implementation. A default implementation of ISWFContext should also be supplied.
There are two reasons for an application to use this interface to control TextLine creation:
Your application may have additional TextLine instances that can be reused. To manually reuse existing TextLine instances:
Please note, however, that the