Adobe® Flex® 4 Language Reference
Hide Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flashx.textLayout.conversion 
ITextImporter 
Packageflashx.textLayout.conversion
Interfacepublic interface ITextImporter

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

Interface for importing text content into a TextFlow from an external source.

View the examples



Public Properties
 PropertyDefined By
  errors : Vector.<String>
[read-only] Errors encountered while parsing.
ITextImporter
  throwOnError : Boolean
Parsing errors during import will cause exceptions if throwOnError is true.
ITextImporter
Public Methods
 MethodDefined By
  
Import text content from an external source and convert it into a TextFlow.
ITextImporter
Property Detail

errors

property
errors:Vector.<String>  [read-only]

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

Errors encountered while parsing. This will be empty if there were no errors. Value is a vector of Strings.



Implementation
    public function get errors():Vector.<String>

throwOnError

property 
throwOnError:Boolean

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

Parsing errors during import will cause exceptions if throwOnError is true.



Implementation
    public function get throwOnError():Boolean
    public function set throwOnError(value:Boolean):void
Method Detail

importToFlow

()method
public function importToFlow(source:Object):flashx.textLayout.elements:TextFlow

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

Import text content from an external source and convert it into a TextFlow.

Parameters

source:Object — Data to convert

Returns
flashx.textLayout.elements:TextFlow — TextFlow created from the source.
ITextImporterExample.as

This code snippet shows a use of the ITextImporter method to perform repeated imports of formatted text. Note that errors are cleared at the beginning of each call to importToFlow.


package flashx.textLayout.conversion.examples
{
    import flashx.textLayout.conversion.ITextImporter;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.elements.TextFlow;
    
    public class ITextImporterExample 
    {
        // Create a new TextFlow based on the markup string
        static public function importAndCheckErrors():TextFlow
        {
            var markup:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'><p><span>Hello, World</span></p></TextFlow>";
            var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
            importer.throwOnError = false;
            var textFlow:TextFlow = importer.importToFlow(markup);
            if (!textFlow)
            {
                var errors:Vector.<String> = importer.errors;
                //deal with import errors
            }
            return textFlow;
        }
    }
}