1 Reply Latest reply: Mar 5, 2012 9:17 PM by Jin-Huang RSS

    Question about html->TextFlow

    voland62

      Hi all.

       

      Does anybody know why this is works:

       

      <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"

                     creationComplete="onComplete(event)">

          <fx:Script>

              <![CDATA[

                  import flashx.textLayout.conversion.TextConverter;

       

                  import mx.events.FlexEvent;

                 

                  private var xml:XML=

                         

                      <p color="0x336699">

                      <b/>

                          The Text   Framework  is an extensible lie typography on the web.

                      </p>

        ;

       

                         

                  private function onComplete(e : FlexEvent) : void

                  {

                      trace(xml);

                     

                      richText.textFlow = TextConverter.importToFlow(xml, TextConverter.TEXT_FIELD_HTML_FORMAT );

                      //richText.textFlow = TextFlowUtil.importFromXML(xml);

                     

                  }

              ]]>

          </fx:Script>

         

          <s:BorderContainer top="10" left="10" right="10" bottom="10">

              <s:RichEditableText id="richText"  />

          </s:BorderContainer>

      </s:Application>

       

       

       

       

      ,but this doesn't:

       

      <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"

                     creationComplete="onComplete(event)">

          <fx:Script>

              <![CDATA[

                  import flashx.textLayout.conversion.TextConverter;

       

                  import mx.events.FlexEvent;

                 

                  private var xml:XML=

                         

                      <p color="0x336699">

                    

                          The Text   Framework  is an extensible lie typography on the web.

                      </p>

        ;

       

                         

                  private function onComplete(e : FlexEvent) : void

                  {

                      trace(xml);

                     

                      richText.textFlow = TextConverter.importToFlow(xml, TextConverter.TEXT_FIELD_HTML_FORMAT );

                      //richText.textFlow = TextFlowUtil.importFromXML(xml);

                     

                  }

              ]]>

          </fx:Script>

         

          <s:BorderContainer top="10" left="10" right="10" bottom="10">

              <s:RichEditableText id="richText"  />

          </s:BorderContainer>

      </s:Application>

       

       

       

      ???

       

       

      Thx.

       

      Andrew