1 Reply Latest reply on Mar 28, 2012 12:00 AM by aktell2007

    displying image imbeded with html text to RichText control

    v-Jay Level 1

      Hi,

       

         Is it possible to render an image embeded with html text in RichText controls.

      My requirement is that to use TextConverter.importToFlow() to set TextFlow to  RichText control.

       

       

       

        
      var 
      str:String="<b>hI</b> This is <i>test</i> <img source='assets/test.jpg' title='icon1' width='30' height='30'/> "
      
        richTxt.textFlow = TextConverter.importToFlow(str, TextConverter.TEXT_FIELD_HTML_FORMAT);
      
        
      <s:RichText 
       id="richTxt" /> 

      The above code do not work for displaying image in html  text.

       

      It is possible using

      TextFlowUtil.importFromString() method but there are some other issues with this approach in handling tags like <b> , <i> and some other tags,  so i dropped to use this method.

       

       

      Please suggest the correct approach if any one know.

       

       

      Thanks.

        • 1. Re: displying image imbeded with html text to RichText control
          aktell2007 Level 1

          Maybe this could help you in a way ! regards aktell2007

           

           

          WebSite.as

           

          package com.assets.EmbedScript {

           

              import flash.display.Sprite;

              import mx.core.BitmapAsset;

           

              public class WebSite extends Sprite {

           

                  [Embed(source="com/assets/imagesContent/website.png")]

                  [Bindable]

                  private var WebSiteImg:Class;

           

                  public function WebSite() {

           

                      super();

           

                      var image:BitmapAsset = new WebSiteImg();

                      addChild(image);

                  }

              }

          }

           

           

          mx:Application

           

          <mx:Script>

                  <![CDATA[

           

                      import com.assets.EmbedScript.WebSite;

           

                      private var img01:WebSite;

           

                  ]]>

          </mx:Script>

           

           

          <img src="com.assets.EmbedScript.WebSite" width="16" height="16"/>