Flex4 TextLayout Part2
Importing Text
In many cases you will need to import text into the framework. This can be especially useful for importing dynamic text that is returned from a remote service or HTTPService at runtime for instance. You can choose from three different conversion options for import/export of text in general. They are:
* TextConverter.TEXT_LAYOUT_FORMAT?convert to/from the text layout markup format
* TextConverter.PLAIN_TEXT_FORMAT?convert to/from a plain text string
* TextConverter.TEXT_FIELD_HTML_FORMAT?convert to/from HTML
source.xml
<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' fontSize='14' textIndent='15' marginBottom='15' paddingTop='4' paddingLeft='4'> <p><span>Hot News!! </span><span fontStyle='italic'> "Toy Story 3"</span><span> has entertained children and parents alike (and has made at least one childless, unmarried adult male in his thirties cry) to the tune of $110 million dollars in its opening weekend.Chances are, considering the amount of money the film made over the weekend, that if you're reading this, there's a better than average chance you've seen the film. If you have, there are a few hidden "Easter eggs" (the cinematic term for meaningful images or references buried in a movie) worthy of a second look. Even if you haven't seen "Toy Story 3," it's worth reading on for some fun facts you can impress your friends with..</span></p> <br/><p><span>Slashfilm and ComingSoon.net have put together exhaustive lists of the Easter eggs hiding in "Toy Story 3," and the New Orleans Times-Picayune also did some digging and found a few pieces of trivia that bear repeating. Highlights of those lists include:• "A113," the number of a classroom at CalTech where many Pixar animators studied, shows up as an Easter egg in every Pixar film. In the "Toy Story" series, it's the license plate on Andy's mother's car. </span></p> <br/> </TextFlow>
TextLayout_Part2.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
viewSourceURL="srcview/index.html">
<s:layout>
<s:VerticalLayout horizontalAlign="center"
verticalAlign="middle"/>
</s:layout>
<fx:Script>
<![CDATA[
import flashx.textLayout.conversion.ITextImporter;
import flashx.textLayout.conversion.TextConverter;
import mx.events.FlexEvent;
protected function ta_creationCompleteHandler(event:FlexEvent):void
{
var taImporter:ITextImporter=TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
ta.textFlow=taImporter.importToFlow(this.taXML);
}
]]>
</fx:Script>
<fx:Declarations>
<fx:XML id="taXML"
source="assets/source.xml"/>
</fx:Declarations>
<s:TextArea id="ta"
creationComplete="ta_creationCompleteHandler(event)"
width="400"
height="300"
editable="false"
lineHeight="20"
fontSize="14"/>
</s:Application>
Originally posted 2010-07-21 06:34:44.



it was very interesting to read flex4fun.com
I want to quote your post in my blog. It can?
And you et an account on Twitter?
Thans for you interesting flex4fun.com .anyone are welcome to quote flex4fun.com any post with a link back to flex4fun.com
flex4fun.com Twitter is “flex4fun” you can find it on the right top corner,