1 Reply Latest reply on Mar 16, 2010 11:29 PM by bornaeon

    Setting text (like HTML) to TextFlow Dynamically



      I have a <s:RichText /> tag and in that I have a <s:TextFlow /> ...

      I want to show specific data each time in my <s:TextFlow /> tag, like:


                <s:span color="#ff0000">

                     some text here
                <s:br />
                <s:div  >                   
                     <s:img id="img1" source="Sunset.jpg" />

      that will show in run time, like this:

         some text here


      These data with all <s:div />, <s:p /> and others tag will be in one string variable.

      How can I bind this string to my textFlow object to show this result?!

        • 1. Re: Setting text (like HTML) to TextFlow Dynamically
          bornaeon Level 1

          I find the way, myself!

          We can use this code for this purpose:



                       import flashx.textLayout.conversion.TextConverter;           
                       var str:String="<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'><div><span color='#ff0000'>some text here</span><br /><div><img id='img1' source='Sunset.jpg' /></div></div></TextFlow>";
               <s:RichText id="richtext1"
                           textFlow="{TextConverter.importToFlow(str, TextConverter.TEXT_LAYOUT_FORMAT)}" />