View comments | RSS feed
Packageflashx.textLayout.elements
Classpublic class TextFlow
InheritanceTextFlow Inheritance ContainerFormattedElement Inheritance ParagraphFormattedElement Inheritance FlowGroupElement Inheritance FlowElement Inheritance Object
Implements IEventDispatcher

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The TextFlow class is responsible for managing all the text content of a story. In TextLayout, text is stored in a hierarchical tree of elements. TextFlow is the root object of the element tree. All elements on the tree derive from the base class, FlowElement.

A TextFlow object can have ParagraphElement and DivElement objects as children. A div (DivElement object) represents a group of paragraphs (ParagraphElement objects). A paragraph can have SpanElement, InlineGraphicElement, LinkElement, and TCYElement objects as children.

A span (SpanElement) is a range of text in a paragraph that has the same attributes. An image (InlineGraphicElement) represents an arbitrary graphic that appears as a single character in a line of text. A LinkElement represents a hyperlink, or HTML a tag, and it can contain multiple spans. A TCYElement object is used in Japanese text when there is a small run of text that appears perpendicular to the line, as in a horizontal run within a vertical line. A TCYElement also can contain multiple spans.

TextFlow also derives from the ContainerFormattedElement class, which is the root class for all container-level block elements.

The following illustration shows the relationship of other elements, such as spans and paragraphs, to the TextFlow object.

example TextFlow hierarchy

Each TextFlow object has a corresponding Configuration object that allows you to specify initial character and paragraph formats and the initial container format. It also allows you to specify attributes for selection, links, focus, and scrolling. When you supply a Configuration object as parameter to the TextFlow() constructor, it creates a read-only snapshot that you can access through the TextFlow.configuration property. After creation, you can't change the TextFlow's configuration. If you do not specify a Configuration, you can access the default configuration through the TextFlow.defaultConfiguration property.

View the examples

See also

configuration
IConfiguration
DivElement
FlowElement
FlowGroupElement
FlowLeafElement
IFlowComposer
ParagraphElement
SpanElement


Public Properties
 PropertyDefined By
 InheritedalignmentBaseline : String
[write-only] CharacterFormat: Specifies the line baseline to which the element baseline specified by the elementBaseline property should align to determine the vertical position of the element on the line.
FlowElement
 InheritedbaselineShift : Object
[write-only] CharacterFormat: Amount to shift the baseline from the elementBaseline.
FlowElement
 InheritedblockProgression : String
[write-only] ContainerFormat: Settings for line layout.
ContainerFormattedElement
 InheritedbreakOpportunity : String
[write-only] CharacterFormat: Controls where lines are allowed to break when wrapping text is broken into multiple lines.
FlowElement
 InheritedcffHinting : String
[write-only] CharacterFormat: The type of CFF hinting used for this text.
FlowElement
 InheritedcharacterFormat : ICharacterFormat
CharacterFormat properties applied directly to this element.
FlowElement
 Inheritedcolor : Object
[write-only] CharacterFormat: Color of the text.
FlowElement
 InheritedcolumnCount : Object
[write-only] ContainerFormat: Number of text columns.
ContainerFormattedElement
 InheritedcolumnGap : Object
[write-only] ContainerFormat: Gutter space between the columns in pixels.
ContainerFormattedElement
 InheritedcolumnWidth : Object
[write-only] ContainerFormat: Width of column in pixels.
ContainerFormattedElement
 InheritedcomputedContainerFormat : IContainerFormat
[read-only] Returns computed values of the container attributes.
ContainerFormattedElement
  configuration : IConfiguration
[read-only] The Configuration object for this TextFlow object.
TextFlow
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcontainerFormat : IContainerFormat
ContainerFormat properties applied directly to this element.
ContainerFormattedElement
  defaultConfiguration : Configuration
[static] Default configuration to be used for all new TextFlow objects if the configuration is not specified.
TextFlow
 InheriteddigitCase : String
[write-only] CharacterFormat: The type of digit case used for this text.
FlowElement
 InheriteddigitWidth : String
[write-only] CharacterFormat: Type of digit width used for this text.
FlowElement
 Inheriteddirection : String
[write-only] ParagraphFormat: Specifies the default bidi embedding level of the text in the text block.
ParagraphFormattedElement
 InheriteddominantBaseline : String
[write-only] CharacterFormat: Specifies which of the baselines of the element snaps to the alignmentBaseline to determine the vertical position of the element on the line.
FlowElement
 InheritedfirstBaselineOffset : Object
[write-only] ContainerFormat: Position of the baseline of first line in the container (in pixels).
ContainerFormattedElement
 InheritedfirstBaselineOffsetBasis : String
[write-only] ContainerFormat: Specifies the baseline to which the firstBaselineOffset property refers.
ContainerFormattedElement
  flowComposer : IFlowComposer
Manages the containers for this element.
TextFlow
 InheritedfontFamily : String
[write-only] CharacterFormat: The name of the font to use, or a comma-separated list of font names.
FlowElement
 InheritedfontLookup : String
[write-only] CharacterFormat: Font lookup to use.
FlowElement
 InheritedfontSize : Object
[write-only] CharacterFormat: The size of the text in pixels.
FlowElement
 InheritedfontStyle : String
[write-only] CharacterFormat: Style of text.
FlowElement
 InheritedfontWeight : String
[write-only] CharacterFormat: Weight of text.
FlowElement
  generation : uint
[read-only] The generation number for this TextFlow object.
TextFlow
  hostCharacterFormat : ICharacterFormat
The host character format for this TextFlow object.
TextFlow
  hostContainerFormat : IContainerFormat
The host container format for this TextFlow object.
TextFlow
  hostParagraphFormat : IParagraphFormat
The host paragraph format for this TextFlow object.
TextFlow
  interactionManager : ISelectionManager
The InteractionManager associated with this TextFlow object.
TextFlow
 InheritedjustificationRule : String
[write-only] ParagraphFormat: Rule used to generate paragraph justification.
ParagraphFormattedElement
 InheritedjustificationStyle : String
[write-only] ParagraphFormat: The style used for justification of the paragraph.
ParagraphFormattedElement
 Inheritedkerning : String
[write-only] CharacterFormat: Kerning adjusts the pixels between certain character pairs to improve readability.
FlowElement
 InheritedleadingBasis : String
[write-only] ParagraphFormat: Specifies the baseline to which the lineHeight property refers.
ParagraphFormattedElement
 InheritedleadingDirection : String
[write-only] ParagraphFormat: Specifies the direction in which leading space is applied.
ParagraphFormattedElement
 InheritedligatureLevel : String
[write-only] CharacterFormat: Controls which of the ligatures that are defined in the font may be used in the text.
FlowElement
 InheritedlineBreak : String
[write-only] ContainerFormat: Controls word wrapping within the container.
ContainerFormattedElement
 InheritedlineHeight : Object
[write-only] CharacterFormat: Leading controls for the text.
FlowElement
 InheritedlineThrough : Object
[write-only] CharacterFormat: Strikethrough.
FlowElement
 Inheritedlocale : String
[write-only] CharacterFormat: The locale of the text.
FlowElement
 InheritedmarginBottom : Object
[write-only] ParagraphFormat: Amount of space in pixels to leave after the paragraph (a Number).
ParagraphFormattedElement
 InheritedmarginLeft : Object
[write-only] ParagraphFormat: Amount in pixels to indent the paragraph (a Number).
ParagraphFormattedElement
 InheritedmarginRight : Object
[write-only] ParagraphFormat: Amount in pixels to indent the right edge of the paragraph (a Number).
ParagraphFormattedElement
 InheritedmarginTop : Object
[write-only] ParagraphFormat: Amount of space in pixels to leave before the paragraph (a Number).
ParagraphFormattedElement
 InheritednumChildren : int
[read-only] Returns the number of FlowElement children that this FlowGroupElement object has.
FlowGroupElement
 InheritedpaddingBottom : Object
[write-only] ContainerFormat: Botttom inset in pixels.
ContainerFormattedElement
 InheritedpaddingLeft : Object
[write-only] ContainerFormat: Left inset in pixels.
ContainerFormattedElement
 InheritedpaddingRight : Object
[write-only] ContainerFormat: Right inset in pixels.
ContainerFormattedElement
 InheritedpaddingTop : Object
[write-only] ContainerFormat: Top inset in pixels.
ContainerFormattedElement
 InheritedparagraphFormat : IParagraphFormat
ParagraphFormat properties applied directly to this element.
ParagraphFormattedElement
 Inheritedparent : FlowGroupElement
[read-only] Returns the parent of this FlowElement object.
FlowElement
 InheritedparentRelativeEnd : int
[read-only] Returns the relative end of this FlowElement object in the parent.
FlowElement
 InheritedparentRelativeStart : int
[read-only] Returns the relative start of this FlowElement object in the parent.
FlowElement
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 InheritedrenderingMode : String
[write-only] CharacterFormat: The rendering mode used for this text.
FlowElement
 InheritedtabStops : Array
[write-only] ParagraphFormat: Specifies the tab stops associated with the paragraph.
ParagraphFormattedElement
 InheritedtextAlign : String
[write-only] ParagraphFormat: Alignment of lines in the paragraph relative to the container.
ParagraphFormattedElement
 InheritedtextAlignLast : String
[write-only] ParagraphFormat: Alignment of the last (or only) line in the paragraph relative to the container in justified text.
ParagraphFormattedElement
 InheritedtextAlpha : Object
[write-only] CharacterFormat: Alpha (transparency) value for the text.
FlowElement
 InheritedtextDecoration : String
[write-only] CharacterFormat: Decoration on text.
FlowElement
 InheritedtextIndent : Object
[write-only] ParagraphFormat: Amount in pixels to indent the first line of the paragraph (a Number).
ParagraphFormattedElement
 InheritedtextLength : int
[read-only] Returns the total length of text owned by this FlowElement object and its children.
FlowElement
 InheritedtextRotation : String
[write-only] CharacterFormat: Determines the amount of degrees to rotate this text.
FlowElement
 Inheritedtracking : Object
[write-only] Sets the tracking and is synonymous with the trackingRight property.
FlowElement
 InheritedtrackingLeft : Object
[write-only] CharacterFormat: Number in pixels (or percent of fontSize, like 120%) indicating the amount of tracking (manual kerning) to be applied to the left of each character.
FlowElement
 InheritedtrackingRight : Object
[write-only] CharacterFormat: Number in pixels (or percent of fontSize, like 120%) indicating the amount of tracking (manual kerning) to be applied to the right of each character.
FlowElement
 InheritedtypographicCase : String
[write-only] CharacterFormat: The type of typographic case used for this text.
FlowElement
 InheritedverticalAlign : String
[write-only] ContainerFormat: Vertical alignment or justification.
ContainerFormattedElement
 InheritedwhiteSpaceCollapse : String
[write-only] CharacterFormat: The setting used to collapse or preserve whitespace when importing text into a TextFlow.
FlowElement
Public Methods
 MethodDefined By
  
TextFlow(config:Configuration = null)
Constructor - creates a new TextFlow instance.
TextFlow
 Inherited
Appends a child FlowElement object.
FlowGroupElement
 Inherited
Adds a child FlowElement object at the specified index position.
FlowGroupElement
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
TextFlow
 Inherited
deepCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a deep copy of the portion of a FlowElement object between two character positions, including any children, and returns it as a FlowElement object.
FlowElement
  
Dispatches an event into the event flow.
TextFlow
 Inherited
findChildIndexAtPosition(relativePosition:int):int
Given a relative text position, find the index of the first child FlowElement that contains relative position.
FlowGroupElement
 Inherited
findLeaf(relativePosition:int):FlowLeafElement
Given a relative text position, find the leaf element that contains the position.
FlowGroupElement
 Inherited
Returns the start location of the element in the text flow as an absolute index.
FlowElement
 Inherited
Returns the ContainerFormattedElement that specifies its containers for filling.
FlowElement
 Inherited
Returns the character at the specified position, relative to this FlowElement object.
FlowElement
 Inherited
Returns the character code at the specified position, relative to this FlowElement.
FlowElement
 Inherited
Returns the FlowElement child at the specified index.
FlowGroupElement
 Inherited
Searches in children for the specified FlowElement object and returns its index position.
FlowGroupElement
 Inherited
Return the effective column direction for this element.
ContainerFormattedElement
 Inherited
Returns the start of this element relative to an ancestor element.
FlowElement
 Inherited
Returns the first FlowLeafElement descendant of this element.
FlowGroupElement
 Inherited
Returns the last FlowLeafElement descendent of this element.
FlowGroupElement
 Inherited
Returns the next FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
Returns the ParagraphElement object associated with this element.
FlowElement
 Inherited
Returns the previous FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
Climbs the text flow hierarchy to return the root TextFlow object for the element.
FlowElement
  
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
TextFlow
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Removes the specified child FlowElement object.
FlowGroupElement
 Inherited
Removes a child FlowElement object at the specified index position.
FlowGroupElement
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
TextFlow
 Inherited
replaceChildren(beginChildIndex:int, endChildIndex:int, ... rest):void
Replaces child elements in the group with the specified new elements.
FlowGroupElement
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
shallowCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a copy of the content of this FlowElement object that occurs between two character positions.
FlowElement
 Inherited
Splits this object at the position specified by the childIndex parameter.
FlowGroupElement
 Inherited
Splits this object at the position specified by the relativePosition parameter, where the relative position is a relative text position in this element.
FlowGroupElement
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
  
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
TextFlow
Events
 Event Summary Defined By
  Dispatched when any link is clicked.TextFlow
  Dispatched after every recompose.TextFlow
  Defines the value of the type property of a flowOperationBegin event object Dispatched before an operation is executed.TextFlow
  Defines the value of the type property of a flowOperationEnd event object Dispatched after an operation completes.TextFlow
  Dispatched when a InlineGraphicElement is resized due to having width or height as auto or percent and the graphic has finished loading.TextFlow
  Dispatched when the mouse is pressed down over any link.TextFlow
  Dispatched when the mouse passes over any link.TextFlow
  Dispatched when the mouse is released over any link.TextFlow
  Dispatched when the mouse goes out of any link.TextFlow
  Dispatched when the mouse first enters any link.TextFlow
  Dispatched by a TextFlow object after text is scrolled within a controller container.TextFlow
  Dispatched whenever the selection is changed.TextFlow
  Dispatched whenever the UndoManager has been called to change its stack of operations.TextFlow
Property Detail
configurationproperty
configuration:IConfiguration  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The Configuration object for this TextFlow object. The Configuration object specifies the initial character and paragraph formats, the initial container format, and attributes for selection highlighting, links, focus, and scrolling.

If you do not specify a Configuration object, Text Layout Framework uses a default Configuration object, which is referenced by the defaultConfiguration property.



Implementation
    public function get configuration():IConfiguration

See also

defaultConfigurationproperty 
public static var defaultConfiguration:Configuration

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Default configuration to be used for all new TextFlow objects if the configuration is not specified.

flowComposerproperty 
flowComposer:IFlowComposer  [read-write]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Manages the containers for this element.

The TextLines that are created from the element appear as children of the container. The flowComposer manages the containers, and as the text is edited it adds lines to and removes lines from the containers. The flowComposer also keeps track of some critical attributes, such as the width and height to compose to, whether scrolling is on, and so on.

The container and flowComposer are closely related. If you reset flowComposer , the container is reset to the new flowComposer's container. Likewise if the container is reset, flowComposer is reset to the container's new flowComposer.



Implementation
    public function get flowComposer():IFlowComposer
    public function set flowComposer(value:IFlowComposer):void

See also

generationproperty 
generation:uint  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The generation number for this TextFlow object. The undo and redo operations use the generation number to validate that it's legal to undo or redo an operation. The generation numbers must match.

Each model change increments generation so if the generation number changes, you know the TextFlow model has changed.



Implementation
    public function get generation():uint
hostCharacterFormatproperty 
hostCharacterFormat:ICharacterFormat  [read-write]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The host character format for this TextFlow object.



Implementation
    public function get hostCharacterFormat():ICharacterFormat
    public function set hostCharacterFormat(value:ICharacterFormat):void

See also

hostContainerFormatproperty 
hostContainerFormat:IContainerFormat  [read-write]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The host container format for this TextFlow object.



Implementation
    public function get hostContainerFormat():IContainerFormat
    public function set hostContainerFormat(value:IContainerFormat):void

See also

hostParagraphFormatproperty 
hostParagraphFormat:IParagraphFormat  [read-write]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The host paragraph format for this TextFlow object.



Implementation
    public function get hostParagraphFormat():IParagraphFormat
    public function set hostParagraphFormat(value:IParagraphFormat):void

See also

interactionManagerproperty 
interactionManager:ISelectionManager  [read-write]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The InteractionManager associated with this TextFlow object.

Controls all selection and editing on the text. If the TextFlow is not selectable, the interactionManager is null. To make the TextFlow editable, assign a interactionManager that is both an ISelectionManager and an IEditManager. To make a TextFlow that is read-only and allows selection, assign a interactionManager that is an ISelectionManager only.



Implementation
    public function get interactionManager():ISelectionManager
    public function set interactionManager(value:ISelectionManager):void

See also

Constructor Detail
TextFlow()Constructor
public function TextFlow(config:Configuration = null)

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructor - creates a new TextFlow instance.

If you provide a config parameter, the contents of the Configuration object are copied and you cannot make changes. You can access configuration settings, however, through the configuration property. If the config parameter is null, you can access the default configuration settings through the defaultConfiguration property.

The Configuration object provides a mechanism for setting configurable default attributes on a TextFlow. While you can't make changes to the Configuration object, you can override default attributes, if necessary, by setting the attributes of TextFlow and its children.

Parameters
config:Configuration (default = null) — Specifies the configuration to use for this TextFlow object. If it's null, use TextFlow.defaultConfiguration to access configuration values.

See also

Method Detail
addEventListener()method
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.

After you successfully register an event listener, you cannot change its priority through additional calls to addEventListener() . To change a listener's priority, you must first call removeEventListener() . Then you can register the listener again with the new priority level.

After the listener is registered, subsequent calls to addEventListener() with a different value for either type or useCapture result in the creation of a separate listener registration. For example, if you first register a listener with useCapture set to true , it listens only during the capture phase. If you call addEventListener() again using the same listener object, but with useCapture set to false , you have two separate listeners: one that listens during the capture phase, and another that listens during the target and bubbling phases.

You cannot register an event listener for only the target phase or the bubbling phase. Those phases are coupled during registration because bubbling applies only to the ancestors of the target node.

When you no longer need an event listener, remove it by calling EventDispatcher.removeEventListener() ; otherwise, memory problems might result. Objects with registered event listeners are not automatically removed from memory because the garbage collector does not remove objects that still have references.

Copying an EventDispatcher instance does not copy the event listeners attached to it. (If your newly created node needs an event listener, you must attach the listener after creating the node.) However, if you move an EventDispatcher instance, the event listeners attached to it move along with it.

If the event listener is being registered on a node while an event is also being processed on this node, the event listener is not triggered during the current phase but may be triggered during a later phase in the event flow, such as the bubbling phase.

If an event listener is removed from a node while an event is being processed on the node, it is still triggered by the current actions. After it is removed, the event listener is never invoked again (unless it is registered again for future processing).

Parameters

type:String — The type of event.
 
listener:Function — The listener function that processes the event. This function must accept an event object as its only parameter and must return nothing, as this example shows:

function(evt:Event):void

The function can have any name.
 
useCapture:Boolean (default = false) — Determines whether the listener works in the capture phase or the target and bubbling phases. If useCapture is set to true , the listener processes the event only during the capture phase and not in the target or bubbling phase. If useCapture is false , the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call addEventListener() twice, once with useCapture set to true , then again with useCapture set to false .
 
priority:int (default = 0) — The priority level of the event listener. Priorities are designated by a 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1 . If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.
 
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not.

Class-level member functions are not subject to garbage collection, so you can set useWeakReference to true for class-level member functions without subjecting them to garbage collection. If you set useWeakReference to true for a listener that is a nested inner function, the function will be garbge-collected and no longer persistent. If you create references to the inner function (save it in another variable) then it is not garbage-collected and stays persistent.

dispatchEvent()method 
public function dispatchEvent(event:Event):Boolean

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent() is called.

Parameters

event:Event — The event object dispatched into the event flow.

Returns
Boolean — A value of true unless preventDefault() is called on the event, in which case it returns false .
hasEventListener()method 
public function hasEventListener(type:String):Boolean

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy. To determine whether a specific event type will actually trigger an event listener, use IEventDispatcher.willTrigger() .

The difference between hasEventListener() and willTrigger() is that hasEventListener() examines only the object to which it belongs, whereas willTrigger() examines the entire event flow for the event specified by the type parameter.

Parameters

type:String — The type of event.

Returns
Boolean — A value of true if a listener of the specified type is registered; false otherwise.
removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

Parameters

type:String — The type of event.
 
listener:Function — The listener object to remove.
 
useCapture:Boolean (default = false) — Specifies whether the listener was registered for the capture phase or the target and bubbling phases. If the listener was registered for both the capture phase and the target and bubbling phases, two calls to removeEventListener() are required to remove both: one call with useCapture set to true , and another call with useCapture set to false .

willTrigger()method 
public function willTrigger(type:String):Boolean

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. This method returns true if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.

The difference between hasEventListener() and willTrigger() is that hasEventListener() examines only the object to which it belongs, whereas willTrigger() examines the entire event flow for the event specified by the type parameter.

Parameters

type:String — The type of event.

Returns
Boolean — A value of true if a listener of the specified type will be triggered; false otherwise.
Event Detail
click Event
Event Object Type: flashx.textLayout.events.FlowElementMouseEvent
property FlowElementMouseEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when any link is clicked.

compositionComplete Event  
Event Object Type: flashx.textLayout.events.CompositionCompletionEvent
property CompositionCompletionEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched after every recompose.

flowOperationBegin Event  
Event Object Type: flashx.textLayout.events.FlowOperationEvent
property FlowOperationEvent.type = flashx.textLayout.events.FlowOperationEvent.FLOW_OPERATION_BEGIN

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Defines the value of the type property of a flowOperationBegin event object Dispatched before an operation is executed. Cancelling this event blocks the operation.
flowOperationEnd Event  
Event Object Type: flashx.textLayout.events.FlowOperationEvent
property FlowOperationEvent.type = flashx.textLayout.events.FlowOperationEvent.FLOW_OPERATION_END

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Defines the value of the type property of a flowOperationEnd event object Dispatched after an operation completes. Any errors are stored in OperationEvent.error . If there is an error, cancelling this event blocks the rethrow of the error. Generally speaking all errors are likely to be fatal.

Changing an operation at this time (after it has been executed) may fail.

inlineGraphicStatusChanged Event  
Event Object Type: flashx.textLayout.events.StatusChangeEvent
property StatusChangeEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when a InlineGraphicElement is resized due to having width or height as auto or percent and the graphic has finished loading.

mouseDown Event  
Event Object Type: flashx.textLayout.events.FlowElementMouseEvent
property FlowElementMouseEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the mouse is pressed down over any link.

mouseMove Event  
Event Object Type: flashx.textLayout.events.FlowElementMouseEvent
property FlowElementMouseEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the mouse passes over any link.

mouseUp Event  
Event Object Type: flashx.textLayout.events.FlowElementMouseEvent
property FlowElementMouseEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the mouse is released over any link.

rollOut Event  
Event Object Type: flashx.textLayout.events.FlowElementMouseEvent
property FlowElementMouseEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the mouse goes out of any link.

rollOver Event  
Event Object Type: flashx.textLayout.events.FlowElementMouseEvent
property FlowElementMouseEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the mouse first enters any link.

scroll Event  
Event Object Type: flashx.textLayout.events.ScrollEvent
property ScrollEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched by a TextFlow object after text is scrolled within a controller container.

selectionChange Event  
Event Object Type: flashx.textLayout.events.SelectionEvent
property SelectionEvent.type = eventType

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched whenever the selection is changed. Primarily used to update selection dependent UI.

undoChanged Event  
Event Object Type: flash.events.Event
property Event.type = flash.events.Event

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched whenever the UndoManager has been called to change its stack of operations.

Examples
TextFlowExample.as

This example creates a TextFlow instance, configuring it with character and paragraph formats, and adds span and paragraph elements to display Hello World.
  1. Add TextLayout to the library.
  2. Save this code as TextFlowExample.as in the same directory as your FLA.
  3. Set the Class in the Properties window of the FLA to TextFlowExample.
package {
    import flash.display.Sprite;
    
    import flashx.textLayout.container.DisplayObjectContainerController;
    import flashx.textLayout.container.IContainerController;
    import flashx.textLayout.elements.Configuration;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.formats.CharacterFormat;
    import flashx.textLayout.formats.ParagraphFormat;
    import flashx.textLayout.formats.JustificationRule;
    import flashx.textLayout.formats.TextAlign;
    import flash.text.engine.FontPosture;
    import flash.text.engine.Kerning;


    public class TextFlowExample extends Sprite
    {
        public function TextFlowExample()
        {
            var config:Configuration = new Configuration();
            var charFormat:CharacterFormat = new CharacterFormat();
            var paraFormat:ParagraphFormat = new ParagraphFormat();
            charFormat.color = 0xFF0000;
            charFormat.fontFamily = "Arial, Helvetica, _sans";
            charFormat.fontSize = 48;
            charFormat.kerning = Kerning.ON;
            charFormat.fontStyle = FontPosture.ITALIC;
            paraFormat.textAlign = TextAlign.CENTER;
            config.textFlowInitialCharacterFormat = charFormat;
            config.textFlowInitialParagraphFormat = paraFormat;
            var textFlow:TextFlow = new TextFlow(config);

            var p:ParagraphElement = new ParagraphElement();
            var span:SpanElement = new SpanElement();
            span.text = "Hello, World!";
            p.addChild(span);
            textFlow.addChild(p);

            textFlow.flowComposer.addController(new DisplayObjectContainerController(this,500,200));
            textFlow.flowComposer.updateAllContainers(); 
        }
    }
}




Comments


viatropos said on May 2, 2009 at 6:03 PM :
I wish this text framework had better model-view-controller separation.
Because it is not open source, it is not going to be able to compete with what
the community can produce in the next year or two.

Some of the things it should include:
- Adding gradient colors to the text dynamically.
- Being able to tween the text lines in a text flow and adjust the selection
highlights while they're tweening, so if it's 3D you can have it glow and
highlight as they rotate (like in the mac RSS screensaver example).
- Being able to customize the effects when the EditManager performs an
action. Hardcoding the idea that when you delete or highlight something, it
should instantly appear is a huge limitation. Now nobody can make
anything NEW out of it, it's just another text framework like all the others. If
you start messing around with the FlowElement and TextLine classes, and
try to add the ability to do innovative animations and such, you'll have to
rebuild the entire layout framework because the EditManager and
SelectionManager are closed to the public and they have not been designed
well.
- Being able to extend the editing functionality.

Basically, it should be open source. So us consumers can contribute our
ideas the project and help shape it how we would use it.

I would like to be able to get in there and customize how things look when I
edit the text, or when the text is created or highlighted but it's impossible
unless I start from scratch and rebuild everything.

Please fix these things.

Warmest,
Lance

http://www.viatropos.com

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/labs/textlayout/flashx/textLayout/elements/TextFlow.html