Package | flashx.textLayout.conversion |
Class | public class PlainTextExporter |
Inheritance | PlainTextExporter ConverterBase Object |
Implements | IPlainTextExporter |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
TextConverter.export()
static method for exporting plain text.
The PlainTextExporter class's export()
method results in the
same output string as the TextConverter.export()
static method
if the two properties of the PlainTextExporter class, the PARAGRAPH_SEPARATOR_PROPERTY
and the STRIP_DISCRETIONARY_HYPHENS_PROPERTY
properties, contain their
default values of "\n"
and true
, respectively.
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
errors : Vector.<String> [read-only] Errors encountered while parsing. | ConverterBase | ||
paragraphSeparator : String Specifies the character sequence used (in a text flow's plain-text equivalent) to separate paragraphs. | PlainTextExporter | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
stripDiscretionaryHyphens : Boolean This property indicates whether discretionary hyphens in the text should be stripped during the export process. | PlainTextExporter | ||
throwOnError : Boolean | ConverterBase | ||
useClipboardAnnotations : Boolean | ConverterBase |
Method | Defined By | ||
---|---|---|---|
Constructor
| PlainTextExporter | ||
Export text content from a TextFlow instance in String, or XML, or a user defined format. | PlainTextExporter | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
paragraphSeparator | property |
paragraphSeparator:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the character sequence used (in a text flow's plain-text equivalent) to separate paragraphs. The paragraph separator is not added after the last paragraph.
This property applies to the PLAIN_TEXT_FORMAT
exporter.
The default value is "\n".
Implementation
public function get paragraphSeparator():String
public function set paragraphSeparator(value:String):void
stripDiscretionaryHyphens | property |
stripDiscretionaryHyphens:Boolean
Language Version: | ActionScript 3.0- |
Runtime Versions: | Flash Player 10, AIR 1.5 |
This property indicates whether discretionary hyphens in the text should be stripped during the export process.
Discretionary hyphens, also known as "soft hyphens", indicate where to break a word in case the word must be
split between two lines. The Unicode character for discretionary hyphens is \u00AD
.
If this property is set to true
, discretionary hyphens that are in the original text will not be in the exported text,
even if they are part of the original text. If false
, discretionary hyphens will be in the exported text.
Implementation
public function get stripDiscretionaryHyphens():Boolean
public function set stripDiscretionaryHyphens(value:Boolean):void
PlainTextExporter | () | Constructor |
public function PlainTextExporter()
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Constructor
export | () | method |
public function export(source:flashx.textLayout.elements:TextFlow, conversionType:String):Object
Export text content from a TextFlow instance in String, or XML, or a user defined format.
Set the conversionType
parameter to either of the following values,
or a user defined format in user-defined exporters.
flashx.textLayout.conversion.ConversionType.STRING_TYPE
;flashx.textLayout.conversion.ConversionType.XML_TYPE
.
Parameters
source:flashx.textLayout.elements:TextFlow — The TextFlow to export
| |
conversionType:String — Return a String (STRING_TYPE) or XML (XML_TYPE), or any user defined format.
|
Object — Object The exported content
|
package flashx.textLayout.conversion.examples { import flash.display.Sprite; import flashx.textLayout.conversion.ConversionType; import flashx.textLayout.conversion.PlainTextExporter; import flashx.textLayout.conversion.TextConverter; import flashx.textLayout.elements.TextFlow; public class PlainTextExporter_example extends Sprite { public function PlainTextExporter_example() { var markup:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>" + "<p><span>Hello, World!</span></p>" + "<p><span>Hello, Hemi" + "\u00AD" + "sphere! </span></p>" + "<p><span>Hello, Hello Continent!</span></p>" + "</TextFlow>"; var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); // first export, using the PlainTextExporter class var textExporter:PlainTextExporter = new PlainTextExporter(); var exportedText:String = textExporter.export(textFlow, flashx.textLayout.conversion.ConversionType.STRING_TYPE) as String; // second export, using TextConverter.export() static method is same as first export with default settings var exportedTextTextConverter:String = TextConverter.export(textFlow,TextConverter.PLAIN_TEXT_FORMAT, ConversionType.STRING_TYPE) as String; // use of PlainTextExporter class allows for custom control of paragraph separators and hyphen interpretation // third export, we change the paragraph separator to a carriage return and linefeed combination textExporter.paragraphSeparator = "\r\n"; exportedText = textExporter.export(textFlow, flashx.textLayout.conversion.ConversionType.STRING_TYPE) as String; // Discretionary hyphen characters are stripped by default. // fourth export, we retain discretionary hyphens by setting the stripDiscretionaryHyphens property to false textExporter.stripDiscretionaryHyphens = false; var exportedTextWithHyphens:String = textExporter.export(textFlow, flashx.textLayout.conversion.ConversionType.STRING_TYPE) as String; // The following should report false after setting stripDiscretionaryHyphens to false var bothExportStringsHaveHyphens:Boolean = (exportedText == exportedTextWithHyphens); } } }
Mon Nov 28 2011, 06:48 AM -08:00