Packageflashx.textLayout.operations
Classpublic class ApplyFormatOperation
InheritanceApplyFormatOperation Inheritance FlowTextOperation Inheritance FlowOperation Inheritance Object

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

The ApplyFormatOperation class encapsulates a style change.

An ApplyFormatOperation applies the leaf format to the text in the specified range (no change is made if the specified range is a single point). It applies the paragraph format to any paragraphs at least partially within the range (or a single paragraph if the range is a single point). And it applies the container format to any containers at least partially within the range (or a single container if the range is a single point).

View the examples

See also

flashx.textLayout.edit.EditManager
flashx.textLayout.events.FlowOperationEvent


Public Properties
 PropertyDefined By
 InheritedabsoluteEnd : int
The absolute end point of the range of text to which this operation is applied.
FlowTextOperation
 InheritedabsoluteStart : int
The absolute start point of the range of text to which this operation is applied.
FlowTextOperation
 InheritedbeginGeneration : uint
[read-only] The text flow generation before the operation.
FlowOperation
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  containerFormat : flashx.textLayout.formats:ITextLayoutFormat
The format properties to apply to the containers in the range.
ApplyFormatOperation
 InheritedendGeneration : uint
[read-only] The text flow generation after the operation.
FlowOperation
  leafFormat : flashx.textLayout.formats:ITextLayoutFormat
The format properties to apply to the leaf elements in the range.
ApplyFormatOperation
 InheritedoriginalSelectionState : SelectionState
The selection state at the start of the operation.
FlowTextOperation
  paragraphFormat : flashx.textLayout.formats:ITextLayoutFormat
The format properties to apply to the paragraphs in the range.
ApplyFormatOperation
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 InheritedtextFlow : flashx.textLayout.elements:TextFlow
The TextFlow object to which this operation is applied.
FlowOperation
 InheriteduserData : *
Arbitrary data associated with an element.
FlowOperation
Public Methods
 MethodDefined By
  
Creates an ApplyFormatOperation object.
ApplyFormatOperation
 Inherited
Executes the operation.
FlowOperation
 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
[override] Re-executes the operation.
FlowTextOperation
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Reverses the operation.
FlowOperation
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail
containerFormatproperty
containerFormat:flashx.textLayout.formats:ITextLayoutFormat

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

The format properties to apply to the containers in the range.

The formats of any containers at least partially within the range are updated. If the range of this operation is a point, then a single container is updated. If containerFormat is null, then no container formats are changed.



Implementation
    public function get containerFormat():flashx.textLayout.formats:ITextLayoutFormat
    public function set containerFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void
leafFormatproperty 
leafFormat:flashx.textLayout.formats:ITextLayoutFormat

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

The format properties to apply to the leaf elements in the range.

If the range of this operation is a point, or if leafFormat is null, then no leaf element formats are changed.



Implementation
    public function get leafFormat():flashx.textLayout.formats:ITextLayoutFormat
    public function set leafFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void
paragraphFormatproperty 
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat

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

The format properties to apply to the paragraphs in the range.

The formats of any paragraphs at least partially within the range are updated. If the range of this operation is a point, then a single paragraph is updated. If paragraphFormat is null, then no paragraph formats are changed.



Implementation
    public function get paragraphFormat():flashx.textLayout.formats:ITextLayoutFormat
    public function set paragraphFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void
Constructor Detail
ApplyFormatOperation()Constructor
public function ApplyFormatOperation(operationState:SelectionState, leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat = null)

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

Creates an ApplyFormatOperation object.

Parameters
operationState:SelectionState — Defines the text range to which the format is applied.
 
leafFormat:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to LeafFlowElement objects in the selected range.
 
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat — The format to apply to ParagraphElement objects in the selected range.
 
containerFormat:flashx.textLayout.formats:ITextLayoutFormat (default = null) — The format to apply to containers in the selected range.
Examples (  How to use this example  )
ApplyFormatOperation_example.as

This code snippet shows a use of the ApplyFormatOperation class. After an operation of this type is executed, the font size of the new TextLayoutFormat is gathered, which can be used to update a display label or menu.

textFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_END, opEndHandler);

public function opEndHandler(evt:FlowOperationEvent):void { 
    var flowOp:FlowOperation = evt.operation; 
    if(flowOp is ApplyFormatOperation && flowOp.leafFormat != NULL) {
        //determine the font size - can be used to update a menu or label
        var fSize:Int = flowOp.leafFormat.fontSize;
    }
}