1 Reply Latest reply on Jul 7, 2011 11:43 PM by aktell2007

    Embed Images into htmlText ....

    aktell2007 Level 1

      Hi there,

       

      I'm searching high and low for a solution how to embed small 16x16 Icon Images into htmlText !

       

      Has anybody an idea where I could find something on the net about that item ???

       

      Found this, but can't get it to work at all.

      http://blog.thehippo.de/2011/03/programming/flex-using-embedded-image-in-html-text/

       

       

      1. package embeds {

      2.         import mx.core.BitmapAsset;
      3.         import flash.display.Sprite;
      4.         public class ImageAsset extends Sprite {

      5.                 [Embed(source="image.jpg")]
      6.                 [Bindable]

      7.                 private var source : Class;
      8.                 public function ImageAsset() {

      9.                         super();
      10.                         var image:BitmapAsset = new source();
      11.                         addChild(image);
      12.                }
      13.         }
      14. }

       

       

      1. <mx:Script>
      2.         <![CDATA[
      3.         import embeds.ImageAsset;
      4.         // this is needed, otherwise the image is not
      5.         // available within the html text
      6.         private var hack:ImageAsset;
      7.         ]]>
      8. </mx:Script>
      9. <mx:Text>
      10.         <mx:htmlText>
      11.                 <![CDATA[<p><img src='embeds.ImageAsset'/>some text</p>]]>
      12.         </mx:htmlText>
      13. </mx:Text>