Skip to main content
March 21, 2007
Question

Embedding/loading jpeg in XML text field

  • March 21, 2007
  • 1 reply
  • 1003 views
Want to embed an image in an XML text field. Any ideas how? I know it can be done, but I'm at a loss. Any help is greatly appreciated.

GHX
This topic has been closed for replies.

1 reply

Inspiring
March 21, 2007
GHX International,

> Want to embed an image in an XML text field. Any ideas
> how? I know it can be done, but I'm at a loss.

Text fields can display text (including formatting) and HTML (also
including formatting, but done in a different way). Flash can also import
XML, so if you're XML -- or at least part of it -- is comprised of the HTML
tags supported by Flash, you're on easy street. Search the phrase
"supported HTML tags" in the documentation and you'll see the full list, but
<im> is certainly one of them. Just like normal HTML, the <img> tag
features a src attribute, and that can be pointed to an external JPG (by
path name) or to a JPG in your Library (by linkage id).

Set your dynamic text field's html property to true, then set its
htmlText property to your HTML-formatted string, including <img> tag.


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."


March 21, 2007
David...

Thank you so much for your response. I did (I think) what you suggested, but still come up with broken text. Here's the situation:

I'm using the DateChooser component, and successfully loading text from an external XML file into dynamic text fields on the stage. The text field into which I want to load an embedded image within the text is called "info_txt". The "info_txt" text field is HTML-enabled, but is not accepting any HTML tags (the text just stops in its tracks when it reaches a tag).

Below is the actionscript I'm using to load the text fields with the XML ("showcalendar.xml") when the user clicks a date on the DateChooser ("myDC"). Again, the text loads perfectly into the fields. But when I add HTML tags into the mix, like the <img src="photo.jpg"> tag, the text stops.