Just a note to self sorta.. the text field and TextArea in Flash almost can't be used if you want to display images in them via standard HTML text. It seems so easy. You have some HTML text that contains a little IMG tag. Flash should act like a browser and display the image and the text in a normal, predictable way. But it doesn't.

I'm testing with Flash Player 8, the SWFs were published for 8. This issue has been around forever.. I've beat on it with a big hammer quite a few times in order to find a workaround, and was hoping it was fixed. But nope. To see a bit of history --- see
here from 2004 on flashmx2004.com
and here where Aral found himself in TextArea hell back in 2004
and here on livedocs
and here on flashkit
and here on Sepiroth.it

Most folks are upset about the TextArea component, but I include the old text field, as you can see below it doesn't act like it should.

Here's just one example.. The Flash Player 8 [edited to add also seeing this with Flash Player 9] should be smart enough to see that the textField and TextArea are only 190 pixels wide and the image is too.. so text should wrap down below the image instead of just partially disappearing off to the right of it. [edited to add clarification.. the two examples below are in Flash. The top one is a TextArea and the bottom one is a text field. The problem is you see "ront of a wall" below the images and the rest of the text is hidden away somewhere to the right of the image.]



code in the SWF:
myTextArea.text = '<img src="http://oddhammer.com/blog/images/samplenewsimage.jpg" width="190" height="102" />Guys in front of a wall';

myTextField.htmlText = '<img src="http://oddhammer.com/blog/images/samplenewsimage.jpg" width="190" height="102" id="myimage"/> Guys in front of a wall';

Here's the same thing in plain old HTML..



guys in front of a wall

<table width="190" border="1" cellspacing="0">
<tr>
<td width="190"><img src="/blog/images/samplenewsimage.jpg" width="190" height="102" />guys in front of a wall </td>
</tr>
</table>

Note that the browser realizes that text can't be beside the image so the text is moved below the image. As you saw above, Flash would do that weird sortawrapping thing.

And it's not so much that the Flash Player 8 is broken, but it doesn't handle images in HTML the same way a browser would. For instance, if you have a bunch of HTML that contains images via the IMG tag and they happen to have align="bottom"... look out. It's going to get ugly. Flash Player 8 only supports "left" and "right". Things like baseline, top, middle, bottom, etc. are just tossed.
I've tested with Flash Player 9 (published for Flash Player 8 though since it'll be ages before I can publish for 9) and see the same thing.

So you can use Flash to display images and text in a somewhat HTMLish fashion if you are careful and creative with the old BR tags and "& nbsp;"s. You can trick Flash into putting images wherever you want. Just hope you don't have a ton of standard HTML text with images that needs to get displayed dynamically in Flash.

And here's some info (added to LiveDocs, yes) that might be of interest...
myTextField.htmlText = '<img src="sampleimage.jpg" width="190" height="102" id="myimage"/>';
trace("width of image = "+myTextField.myimage._width); // width of image = 190


I'm hoping somebody can come along with an easy solution..