Adobe® Flex® 4 Language Reference
Hide Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
spark.utils 
TextFlowUtil 
Packagespark.utils
Classpublic class TextFlowUtil
InheritanceTextFlowUtil Inheritance Object

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

TextFlowUtil is a utility class which provides methods for importing a TextFlow from, and exporting a TextFlow to, the markup language used by the Text Layout Framework.



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
  
[static] Exports a TextFlow into the markup language used by the Text Layout Framework, in the form of XML.
TextFlowUtil
 Inherited
Indicates whether an object has a specified property defined.
Object
  
importFromString(markup:String, whiteSpaceCollapse:String = "collapse"):flashx.textLayout.elements:TextFlow
[static] Creates a TextFlow by importing (i.e., parsing) a String containing the markup language used by the Text Layout Framework.
TextFlowUtil
  
importFromXML(markup:XML, whiteSpaceCollapse:String = "collapse"):flashx.textLayout.elements:TextFlow
[static] Creates a TextFlow by importing (parsing) XML that contains the markup language used by the Text Layout Framework.
TextFlowUtil
 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
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
Returns the primitive value of the specified object.
Object
Method Detail

export

()method
public static function export(textFlow:flashx.textLayout.elements:TextFlow):XML

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

Exports a TextFlow into the markup language used by the Text Layout Framework, in the form of XML.

The root tag of the exported XML will be

      <TextFlow xmlns="http://ns.adobe.com/textLayout/2008" ...>
      

Parameters

textFlow:flashx.textLayout.elements:TextFlow — The TextFlow to be exported in Text Layout Framework markup language.

Returns
XML — XML containing Text Layout Framework markup language.

importFromString

()method 
public static function importFromString(markup:String, whiteSpaceCollapse:String = "collapse"):flashx.textLayout.elements:TextFlow

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

Creates a TextFlow by importing (i.e., parsing) a String containing the markup language used by the Text Layout Framework.

An example of a markup string is

      "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>
      

Hello, World!

</TextFlow>"

However, you can use terser markup such as

"Hello, World!"
. It will get wrapped with a TextFlow tag in the proper namespace, and span and paragraph tags will get automatically inserted where needed to comply with the structure of a TextFlow.

If you specify the TextFlow tag yourself, it must be in the correct XML namespace for runtime Text Layout Framework markup, which is "http://ns.adobe.com/textLayout/2008".

Incorrect markup will cause this method to throw various exceptions. The error message will contain information about why it could not be parsed.

Parameters

markup:String — The markup String to be imported.
 
whiteSpaceCollapse:String (default = "collapse") — A String indicating whether the whitespace in the markup should be collapsed or preserved. The possible values are WhiteSpaceCollapse.COLLAPSE and WhiteSpaceCollapse.PRESERVE in the flashx.textLayout.formats.WhiteSpaceCollapse class. The default value is WhiteSpaceCollapse.COLLAPSE.

Returns
flashx.textLayout.elements:TextFlow — A new TextFlow instance created from the markup.

importFromXML

()method 
public static function importFromXML(markup:XML, whiteSpaceCollapse:String = "collapse"):flashx.textLayout.elements:TextFlow

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

Creates a TextFlow by importing (parsing) XML that contains the markup language used by the Text Layout Framework.

An example of markup XML is

      <TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>
        

Hello, World!

</TextFlow>

You can also use terser markup such as the following:

      "Hello, <span fontWeight='bold'>World!</span>"
      
The parser wraps the markup with a <TextFlow> tag in the proper namespace. The parser also inserts <span> and <paragraph> tags where needed to comply with the structure of a TextFlow object.

If you specify the TextFlow tag yourself, it must be in the correct XML namespace for runtime Text Layout Framework markup, which is "http://ns.adobe.com/textLayout/2008".

Incorrect markup causes this method to throw various exceptions. The error message contains information about why it could not be parsed.

Parameters

markup:XML — The markup XML to be imported.
 
whiteSpaceCollapse:String (default = "collapse") — A String indicating whether the whitespace in the markup should be collapsed or preserved. The possible values are WhiteSpaceCollapse.COLLAPSE and WhiteSpaceCollapse.PRESERVE in the flashx.textLayout.formats.WhiteSpaceCollapse class. The default value is WhiteSpaceCollapse.COLLAPSE.

Returns
flashx.textLayout.elements:TextFlow — A new TextFlow instance created from the markup.