loading Image inside htmlText component

120 views
Skip to first unread message

Thiruvengadam

unread,
Dec 7, 2007, 5:43:17 AM12/7/07
to flex_...@googlegroups.com

Hi

I want that the <img> tag in TextField should take the src path from an Flex embed source is it possible ?? I don't want it to download the image as on server it takes a very long time any idea????????????

 

<?xml version="1.0"?>

 

<mx:Application

      xmlns:mx="http://www.adobe.com/2006/mxml " layout=" vertical " width="800 " xmlns:local="* " >

<mx:Script>

      <![CDATA[

           

           

     

            [Embed (source= "flag_Argentina.gif")]

            public var imgCls:Class;

 

           

           

      ]]>

</mx:Script>

<mx:Text id=" myText" >

<mx:htmlText>

        <![CDATA[

            <p>You can include an image in your HTML text with the &lt;img&gt; tag.</p><p><img src='{imgCls}' width='30' height='30' align='left' hspace='10' vspace='10'>Here is text that follows the image. I'm extending the text by lengthening this sentence until it's long enough to show wrapping around the bottom of the image.</p>

 

        ]]>

     </mx:htmlText>

 

</mx:Text>

  </mx:Application>

Arul Prasad M L

unread,
Dec 7, 2007, 3:12:29 PM12/7/07
to flex_...@googlegroups.com
Your code is passing a 'Class' to the src attribute. The src attribute takes the path to the image - a string, not the Image itself.

If you come from a Flash background, you'd know that the Flash player could use either a source path for an image, or - a linkageID for a symbol inside the SWF's library. Now since you are embedding the asset into the swf, you will definitely have the linkageID.

Your image's linkage id would be  "Blah_imgCls" - where Blah is name of ur mxml file. Now, use "Blah_imgCls" as the value for the src property - ( src='Blah_imgCls' ). That should render the image.

Am not sure if there is another way, its abt 4 AM now, and i couldn't think of a better solution. :P

~Arul Prasad
--
Arul Prasad
http://arulprasad.blogspot.com

Thiruvengadam

unread,
Dec 8, 2007, 2:20:06 AM12/8/07
to flex_...@googlegroups.com
thanks man for the effect U but at 4 in the morning
--
With Love,
Thiru
(09819073715)
Reply all
Reply to author
Forward
0 new messages