| 包 | flashx.textLayout.operations | 
| 类 | public class ApplyFormatOperation | 
| 继承 | ApplyFormatOperation    FlowTextOperation   FlowOperation   Object | 
| 语言版本: | ActionScript 3.0 | 
| 运行时版本: | Flash Player 10, AIR 1.5 | 
ApplyFormatOperation 将页格式应用于指定范围的文本(如果指定的范围为单个点,不会进行任何更改)。它将段落格式应用于至少部分在该范围内的段落(如果范围为单个点,则应用于单个段落)。它将容器格式应用于至少部分在该范围内的容器(如果范围为单个点,则应用于单个容器)。
相关 API 元素
公共属性
| 属性 | 由以下参数定义 | ||
|---|---|---|---|
![]()  | absoluteEnd : int  
		 要应用该操作的文本范围的结束点绝对值。  | FlowTextOperation | |
![]()  | absoluteStart : int  
		 要应用该操作的文本范围的起始点绝对值。  | FlowTextOperation | |
![]()  | beginGeneration : uint [只读] 
		 操作之前生成文本流。  | FlowOperation | |
![]()  | constructor : Object 
	 对类对象或给定对象实例的构造函数的引用。  | Object | |
| containerFormat : flashx.textLayout.formats:ITextLayoutFormat  
		 要应用于该范围的容器的格式属性。  | ApplyFormatOperation | ||
![]()  | endGeneration : uint [只读]  
		 操作之后生成文本流。  | FlowOperation | |
| leafFormat : flashx.textLayout.formats:ITextLayoutFormat  
		 要应用于该范围的页元素的格式属性。  | ApplyFormatOperation | ||
![]()  | originalSelectionState : SelectionState  
		 操作开始时的选择状态。  | FlowTextOperation | |
| paragraphFormat : flashx.textLayout.formats:ITextLayoutFormat  
		 要应用于该范围的段落的格式属性。  | ApplyFormatOperation | ||
![]()  | textFlow : flashx.textLayout.elements:TextFlow  
		 要应用该操作的 TextFlow 对象。  | FlowOperation | |
![]()  | userData : *  
		 与元素关联的任意数据。  | FlowOperation | |
公共方法 
| 方法 | 由以下参数定义 | ||
|---|---|---|---|
ApplyFormatOperation(operationState:SelectionState, leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat = null)  
		 创建 ApplyFormatOperation 对象。  | ApplyFormatOperation | ||
![]()  | 	
		 测试此操作是否被放置在撤消堆栈上。  | FlowOperation | |
![]()  |  
		 执行操作。  | FlowOperation | |
![]()  | 
	 表示对象是否已经定义了指定的属性。  | Object | |
![]()  | 
	 表示 Object 类的实例是否在指定为参数的对象的原型链中。  | Object | |
![]()  | 
	 表示指定的属性是否存在、是否可枚举。  | Object | |
![]()  | [覆盖] 	
		 	
		 重新执行操作。  | FlowTextOperation | |
![]()  | 
     设置循环操作动态属性的可用性。  | Object | |
![]()  | 
	 返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。  | Object | |
![]()  | 
	 返回指定对象的字符串表示形式。  | Object | |
![]()  | 	
		 取消操作。  | FlowOperation | |
![]()  | 
	 返回指定对象的原始值。  | Object | |
属性详细信息
containerFormat | 属性 | 
containerFormat:flashx.textLayout.formats:ITextLayoutFormat| 语言版本: | ActionScript 3.0 | 
| 运行时版本: | Flash Player 10, AIR 1.5 | 
要应用于该范围的容器的格式属性。
更新至少部分在该范围内的容器的格式。如果该操作的范围为一个点,则更新单个容器。如果 containerFormat 为 null,则不更改任何容器格式。
实现
    public function get containerFormat():flashx.textLayout.formats:ITextLayoutFormat    public function set containerFormat(value:flashx.textLayout.formats:ITextLayoutFormat):voidleafFormat | 属性 | 
leafFormat:flashx.textLayout.formats:ITextLayoutFormat| 语言版本: | ActionScript 3.0 | 
| 运行时版本: | Flash Player 10, AIR 1.5 | 
要应用于该范围的页元素的格式属性。
如果该操作的范围为一个点,或者 leafFormat 为 null,则不会更改任何叶元素格式。
实现
    public function get leafFormat():flashx.textLayout.formats:ITextLayoutFormat    public function set leafFormat(value:flashx.textLayout.formats:ITextLayoutFormat):voidparagraphFormat | 属性 | 
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat| 语言版本: | ActionScript 3.0 | 
| 运行时版本: | Flash Player 10, AIR 1.5 | 
要应用于该范围的段落的格式属性。
更新至少部分在该范围内的段落的格式。如果该操作的范围为一个点,则更新单个段落。如果 paragraphFormat 为 null,则不更改任何段落格式。
实现
    public function get paragraphFormat():flashx.textLayout.formats:ITextLayoutFormat    public function set paragraphFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void构造函数详细信息
ApplyFormatOperation | () | 构造函数 | 
public function ApplyFormatOperation(operationState:SelectionState, leafFormat:flashx.textLayout.formats:ITextLayoutFormat, paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat, containerFormat:flashx.textLayout.formats:ITextLayoutFormat = null)| 语言版本: | ActionScript 3.0 | 
| 运行时版本: | Flash Player 10, AIR 1.5 | 
创建 ApplyFormatOperation 对象。
参数operationState:SelectionState — 定义要应用格式的文本范围。
		   | |
leafFormat:flashx.textLayout.formats:ITextLayoutFormat —  要应用于选定范围的 LeafFlowElement 对象的格式。
		   | |
paragraphFormat:flashx.textLayout.formats:ITextLayoutFormat — 要应用于选定范围的 ParagraphElement 对象的格式。
		   | |
containerFormat:flashx.textLayout.formats:ITextLayoutFormat (default = null) — 要应用于选定范围的容器的格式。
		 
		  | 
示例 如何使用本示例 
ApplyFormatOperation_example.as
以下代码片段显示 ApplyFormatOperation 类的应用。执行该类型的操作后,将收集新 TextLayoutFormat 的字体大小,然后可将其用于更新显示标签或菜单。 
package flashx.textLayout.operations.examples
{
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.events.FlowOperationEvent;
    import flashx.textLayout.operations.ApplyFormatOperation;
    
    public class ApplyFormatOperation_example
    {
        public function attach(textFlow:TextFlow):void
        {
            textFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_BEGIN, opEndHandler);
        }
        
        public function opEndHandler(evt:FlowOperationEvent):void { 
            var flowOp:ApplyFormatOperation = evt.operation as ApplyFormatOperation; 
            if (flowOp is ApplyFormatOperation && flowOp.leafFormat != null && evt.cancelable) {
                //determine the font size - can be used to update a menu or label
                var fSize:int = flowOp.leafFormat.fontSize;
                if (fSize > 18)
                    evt.preventDefault();
            }
        }
    }
        
}
Tue Jun 12 2018, 11:04 AM Z
 
 隐藏继承的公共属性
 显示继承的公共属性