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

    Setting text (like HTML) to TextFlow Dynamically

    bornaeon

      Hi

      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:div>              
                <s:span color="#ff0000">

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


      that will show in run time, like this:


         some text here

      Sunset.jpg


      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:


           

           

               <fx:Script>
                   <![CDATA[
                       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>";
                                 
                   ]]>
               </fx:Script>
              
              
               <s:RichText id="richtext1"
                           textFlow="{TextConverter.importToFlow(str, TextConverter.TEXT_LAYOUT_FORMAT)}" />

           

           


          Cheers...